Commit Graph

2 Commits

Author SHA1 Message Date
Martin Gencur ecf3863941
Simplify the test/upgrade package (#2663)
* Top-level structure of test execution changed

* Use t.Parallel properly

* Put back passing Log for test purposes

* More changes

* Prevent panic in unit tests

* All tests passing

* Simplify TestSkipAtBackgroundVerification

* Reduce background_verif_test

* Print name of continual test instead of Continual Test XXX

* Simplify sending stop event

* All tests passing

* background_verification_test using t.Fatal

* Remove old stuff

* Remove old comments

* Remove comment

* Properly initialize logger from LogConfig

* Quite early

* Remove backwards compatible Log from Configuration

* Get rid of suiteExecution failed field

* Minor cleanup

* Bring back most of TestSkipAtBackgroundVerification

* Minor syntactic fix

* Remove unused postVerifyContinual field

* Execute OnWait at least once

* Remove redundant close

* Close closeCh after failed Setup phase

* Do not call OnWait at least once

* Put back error message verification

* Unit tests passing with GOMAXPROCS=2

* remove redundant Eventing continual test as this functionality is
  already tested by Serving continual test
* remove redundant ShouldNotBeSkippedTest - this was a normal passing
  test which is already tested elsewhere

* Add a note about GOMAXPROCS and logical CPUs for upgrade tests

* Use completeSuite where no failures are expected

* Create new zaptest.Logger for each sub-test

This will print output on test failure

* Deprecate LogConfig.Config as it is unused

* Rename Parallel/UpgradeDowngrade to Run/Steps

* minor change in comment

* Fix test
2023-01-10 14:46:49 +00:00
Martin Gencur 8681fe2035
Continual tests logging within test scope (#2293)
* Continual tests logging within test scope

* Make ThreadSafeBuffer unexported

* logBuffer private on BackgroundContext

* log the buffer in Setup phase on success as well

* Use AddCaller and Development for actual (non-test) logging

* Highlight background logs

* Initial newline for background logs

* Remove space before Background log end

* Style

* Pass LogConfig instead of Log

* Introduce new typ Configuration.LogConfig that is accepted by the Execute function. This
  type holds the zap logger configuration and a custom build function for producing
  the resulting logger.
* The zap Config can be reused to produce the internal logger for background tests. This
  way the background logger can share most configuration with the main framework logger.
* Keep the Configuration.Log variable for backwards compatibility reasons. It's used when
  no Configuration.LogConfig is defined.
* Modify tests to use a background test logger in Continual/Background tests
  so that we can verify those tests are executed correctly.

* Review changes

* Wrapping logs back to testing.T

* Write background logs before AND after Verify phase

* To prevent losing background logs when the Verify phase calls t.Fail
or t.Skip

* Use InMemoryLogger in setup phase as well

* that's where the logger is passed to tests and its background
operations (e.g. prober)

* Verify background logs for skipped test

* Add TestFailAtBackgroundVerification and rename the test file

* the file now includes more tests for the background verification
phase, not just "skip"

* Simplify verifyBackgroundLogs and remove redundant suffix for logs

* Better zap Config default value

* Override output paths if set to default value

* Do not pass zap.Config by reference

* Trigger checks

Co-authored-by: Chris Suszyński <ksuszyns@redhat.com>
2022-02-01 05:20:31 -08:00