Commit Graph

343 Commits

Author SHA1 Message Date
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
Dave Protasowski c568527ffc
Fixes #2308 TestSpoofingClient_WaitForEndpointState flake (#2387) 2022-01-11 23:42:50 -08:00
Dave Protasowski 785eb637f6
switch to klog/v2 (#2386) 2022-01-11 13:02:14 -08:00
Julian Friedman fe5b178f35
Tidy helper to avoid need for nosec comment (#2377)
* Tidy helper to avoid need for nosec comment

Currently we fmt.Sprintf a command string only to immediately split it
back in to args, which causes gosec to complain about unsanitised inputs
to exec.Command. Refactoring this to directly pass an args array is
clearer, more secure, and avoids needing the nosec comment.

* Drop helper method
2021-12-14 04:44:51 -08:00
Markus Thömmes 438776b3c8
Drop unused test/cmd package (#2366) 2021-11-29 11:58:04 -08:00
Kenjiro Nakayama 54071addcd
Add retry checker for DNS failure from Ingress (#2351) 2021-11-17 02:06:34 -08:00
Kenjiro Nakayama 0b0c3390a4
Remove unclear comment for makeSpoofClient() (#2347) 2021-11-11 03:49:38 -08:00
Martin Gencur 74ac82a333
Check Knative CustomResourceDefinitions stored version (#2272)
* Check Knative CustomResourceDefinitions stored version

* Use testing.T to log errors

* Address review
2021-10-04 06:38:27 -07:00
Markus Thömmes 73d4fe679a
Drop Retrying and EventuallyMatchesBody checks (#2278) 2021-09-07 04:23:19 -07:00
Markus Thömmes bb433c9814
Add tests for retriable errors to the spoof client (#2277)
* Simplify spoof tests a bit

* Add tests for retriable errors
2021-09-06 03:54:43 -07:00
Kenjiro Nakayama b09fa45a1d
Declare `DefaultErrorRetryChecker` as `ErrorRetryChecker` type (#2276)
This patch changes `DefaultErrorRetryChecker` to `ErrorRetryChecker`
type before adding in the interface array.

Without it, the type of DefaultErrorRetryChecker is still `func(error) (bool, error)`.
2021-09-06 01:43:43 -07:00
Markus Thömmes fbe9e7ed4d
Widen the error checker interface to allow response error checking (#2253)
* Widen the error checker interface to allow response error checking

* Fix grammar
2021-09-02 21:55:57 -07:00
Markus Thömmes c69aba0aae
Deduplicate Check and Poll functions on the spoof client (#2264) 2021-09-02 10:59:07 -07:00
Fabian Lopez b721b0b90c
fix check calls being unreliable (#2250)
* fix check calls being unreliable

Signed-off-by: Fabian Lopez <lfabian@vmware.com>

* move log output inside error check if statement

Signed-off-by: Fabian Lopez <lfabian@vmware.com>
2021-09-02 10:31:07 -07:00
Yanwei Guo a70bb26767
Add length limit for the generated names used in tests (#2217)
* add limit

* typo

* remove childname
2021-08-25 00:00:25 -07:00
Julian Friedman 50410e0b83
Use consistent case for "Deprecated" comments (#2216)
* Use consistent case for "Deprecated" comments

Not the most important thing ever, but the canonical string to use for
Deprecated warnings is case sensitive, and also it's nice to be
consistent.

* Add nolint comment
2021-08-17 09:15:16 -07:00
Ben Moss fa8095f04e
Use default Kubeconfig loading rules (#2197)
This mimics the behavior of tools like kubectl, should work for
both in-cluster and out-of-cluster usages
2021-07-22 11:42:03 -07:00
Dave Protasowski d9b7180af6
minor bug when passing spoof options (#2194)
The array needed to be spread using the '...' operator
2021-07-15 10:56:32 -07:00
salaboy dbcf4cf637
removing default for KUBECONFIG to enable in cluster tests (#2191) 2021-07-15 06:35:32 -07:00
Fabian Leonardo Lopez Bernal 459d3176a7
Add CheckEndpointState method to SpoofingClient (#2166)
* add CheckEndpointState method to SpoofingClient

Signed-off-by: Fabian Lopez <lfabian@vmware.com>
Co-authored-by: Sameer Vohra <vsameer@vmware.com>

* add boolean parameter to control polling behavoir on "EndpointState" checks

Signed-off-by: Fabian Lopez <lfabian@vmware.com>

* add unit test for CheckEndpointState method

Signed-off-by: Fabian Lopez <lfabian@vmware.com>

* move CheckEndpointState test to the spoof package

* add tests for WaitForEndpointState method

Signed-off-by: Fabian Lopez <lfabian@vmware.com>

* simplify Wait/Check unit tests and implementation

Signed-off-by: Fabian Lopez <lfabian@vmware.com>

Co-authored-by: Sameer Vohra <vsameer@vmware.com>
2021-07-13 07:32:51 -07:00
Markus Thömmes fe90576475
Retry 'no route to host' errors by default (#2181)
* Retry 'no route to host' errors by default

* Fix typo
2021-07-06 10:46:20 -07:00
Julian Friedman e117baa4cf
Replace reference to obsolete xip.io service (#2169)
We use sslip now, since xip.io is no more.
2021-06-25 10:27:21 -07:00
Dave Protasowski 841aa7369c
fix package name (#2159) 2021-06-16 12:52:22 -07:00
Dave Protasowski c96c7beb09
drop kubeclient struct (#2151) 2021-06-10 10:14:44 -07:00
Dave Protasowski 0f304f6e4f
support multiple cleanup functions (#2141)
* support multiple cleanup functions

* comment on the expected order

* add boilerplate

* poll while we wait for the test subprocess to setup

* use a tmp file to sychronize the two test processes
this should avoid the data race of reading the subprocess's stdout

* don't make this a breaking change

* fix lint issues
2021-06-10 05:30:43 -07:00
Dave Protasowski 803d2ba3ba
use more general kubernetes.Interface (#2135) 2021-05-31 06:44:32 -07:00
Dave Protasowski 47dfdcfaed
consolidate k8s flags to an environment package (#2133)
* consolidate k8s flags to an environment package

* add copyright

* fix comment style

* use go1.16 in workflows so downstream tests work

* Deprecate GetRESTConfig and do not remove

* update copyright date
2021-05-28 13:30:30 -07:00
Markus Thömmes 980a33719a
Fix revive related linting issues (#2131) 2021-05-26 01:10:28 -07:00
Stavros Kontopoulos b80a192625
Improve state reporting in kube checks (#2082)
* improve state reporting in kube check

* use spew

* update

* nits
2021-04-16 09:13:10 -07:00
Evan Anderson 728bc4ad4e
Update OWNERS_ALIASES to match autogen in community (#2078) 2021-04-08 07:42:51 -07:00
Markus Thömmes 40488532be
Drop master references to knative repos (#2050) 2021-03-11 09:48:26 -08:00
Markus Thömmes acbf2af596
Harden logstream against non-object events (#1984) 2021-01-12 06:39:30 -08:00
Markus Thömmes 7226f4f447
Unify usage of YAML libraries (#1971)
* Replace ghodss/yaml with sigs.k8s.io/yaml

* Replace unnecessary usage of gopkg.in/yaml too
2020-12-17 07:24:02 -08:00
knative-automation 95b8793bd6
Format markdown (#1967)
Signed-off-by: Knative Automation <automation@knative.team>
2020-12-15 17:45:58 -08:00
Igor Belianski ef8048c0ba
Enable multi namespace log collection in e2e test (#1959)
* enable multi namespace log collection in e2e test

* Update test/logstream/README.md

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update test/logstream/README.md

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update test/logstream/interface.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* var grouping of global variables

* fix broken build

* Update test/logstream/README.md

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update test/logstream/v2/stream_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update test/logstream/v2/stream_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update test/logstream/v2/stream.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* minor misc style fixes

* closing brackets spacing

* Update test/logstream/v2/stream.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

Co-authored-by: Victor Agababov <vagababov@gmail.com>
2020-12-15 12:24:58 -08:00
Antoine Cotten af53027cbd
Format copyright headers to match boilerplate (#1962) 2020-12-15 02:12:43 -08:00
Jean-Rémy Bancel b1ac587fdd
Fix missing 'to'. (#1952) 2020-12-08 17:12:41 -08:00
Victor Agababov 7e918163fc
Fix some nits around logging (#1946) 2020-12-07 14:50:40 -08:00
Victor Agababov c9bac6be76
Log if the deserialized line is semi-normal. (#1939)
Right now they panic and we lose all the context.
2020-12-04 09:55:09 -08:00
Victor Agababov b89ac2a632
Fix the logstream since it's paniciiiiing (#1938)
The thing instroduced here: https://github.com/knative/pkg/pull/1773
2020-12-03 17:32:09 -08:00
Zhongduo Lin (Jimmy) e5346d90e9
feat/perf-test: continue test when fail to get commit id (#1930)
* feat/perf-test: continue test when fail to get commit id

changeset.Get does not work well when the test image is in the
vendor directory because there is no kodata setup. After this
commit, failure to get the commit id will result in a
log entry instead of failing the whole test.

* Update test/mako/sidecar.go

Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>

Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com>
2020-11-30 11:24:36 -08:00
Dave Protasowski e1306afead
move some spoof helpers to the spoof package (#1827)
This helps avoid pulling in the pkg/test globals
2020-11-24 10:23:35 -08:00
Chris Suszynski ac327c4338
Skip at BackgroundOperation's verify stage doesn't hang tests (#1912) 2020-11-17 10:07:51 -08:00
Victor Agababov 93fedf1413
Various test improvements in formatting (#1904) 2020-11-12 12:10:59 -08:00
Markus Thömmes d9c4e5c439
Fix a few more occurrences of divisive language (#1902) 2020-11-12 06:41:59 -08:00
Markus Thömmes 7205f2d264
Remove TLogger and relevant interfaces (#1875) 2020-11-04 08:00:04 -08:00
Markus Thömmes 565516e224
Add errorlint and fix all existing issues (#1855) 2020-10-29 01:14:35 -07:00
Dave Protasowski e135a17378
use the default unit test runner (#1871) 2020-10-28 07:28:34 -07:00
Scott Nichols 826303ca06
use new hack repo (#1858) 2020-10-27 15:38:33 -07:00
Matt Moore a37d20384b
Support short suffix in zipkin config (#1840) 2020-10-26 09:28:41 -07:00