Commit Graph

229 Commits

Author SHA1 Message Date
Yanwei Guo 060135fc89 Record metrics if config is nil (#315)
* record if nil

* some more comment

* some more comment

* return
2019-03-11 13:28:43 -07:00
Markus Thömmes efe322d2ca Remove 'MatchesAny'. (#312) 2019-03-11 05:37:42 -07:00
Stefan Prodan f8007289b2 Add CORS Policy to Istio HTTP route (#294)
Signed-off-by: stefanprodan <stefan.prodan@gmail.com>
2019-03-08 16:35:41 -08:00
Alex DiCarlo cc337f8142 Fix VirtualService tcp and tls definitions (#268)
* Fix VirtualService tcp and tls definitions

* Regenerate deepcopy for istio/v1alpha3

* Remove out of date comment

* Fix up comments
2019-03-08 16:30:41 -08:00
Markus Thömmes 07cb28db97 Consistently log the full response on errors in tests. (#313)
* Consistently log the full response on errors in tests.

* Remove unnecessary String() call.
2019-03-08 09:50:41 -08:00
Yanwei Guo 2b411285d2 Use a fake exporter in unit tests (#311)
* add fake exporter

* change comment
2019-03-07 16:12:41 -08:00
Yanwei Guo b4a3bde045 Decide whether to record metrics according to current metrics config (#292)
* split and update

* bug fixed

* change the copyright year

* use fake metadata in tests

* exclude test coverage for gcp_metadata

* add record

* add tests

* revert 2019 and add a new var

* change documents

* address comment

* change line
2019-03-07 10:26:42 -08:00
mattmoor-sockpuppet f05e26f201 golang format tools (#307)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-03-07 07:05:40 -08:00
mattmoor-sockpuppet e191fc0811 golang format tools (#304)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-03-07 07:00:43 -08:00
Matt Moore cbb16f0f4a Add support for URLs vs. simple domains to WaitForEndpointState* (#308) 2019-03-06 20:29:40 -08:00
Bob Corsaro 1ed7b993c8 Updates istio HTTPMatchRequest api (#305)
* Updates istio HTTPMatchRequest api

* Updates generated code
2019-03-05 12:19:39 -08:00
srinivashegde86 e5c43dce06 Separate common monitoring methods into monitoring package (#302)
* Separate common monitoring methods into monitoring package

* Add doc.go to monitoring

* Update doc.go to add information about the public methods

* Fix build tests
2019-03-02 18:20:38 -08:00
mattmoor-sockpuppet a3220b881c Format markdown (#301)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
2019-03-01 12:45:38 -08:00
Victor Agababov c100323403 Fix the sugared logger usage (#300)
* Fix the sugared logger usage

Without `w` the logged messages are quite useless and annoying.

* some more magic
2019-02-28 18:17:38 -08:00
mattmoor-sockpuppet 23907fa727 golang format tools (#298)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-28 10:06:49 -08:00
srinivashegde86 cccc0604d0 Use FormatLogger instead of func parameter (#297) 2019-02-27 15:47:49 -08:00
srinivashegde86 2a8c1b0e5a Remove baselogger and use FormatLogger everywhere (#296)
* Remove baselogger and use FormatLogger everywhere

* Fix blank spaces in README

* Fix linting issues

* Fix comment to FormatLogger
2019-02-27 11:29:49 -08:00
dushyanthsc 41761b2c81 Adding default zipkin tracing support to SpoofClient (#273)
Existing support for Zipkin tracing pushes the
responsibility of logging zipkin traces to
individual tests. This change moves the responsibility
to SpoofClient, so that all tests get it by default.
Traces are logged only for requests that have
encountered Server errors i.e if the
http.Response.StatusCode between 500 to 599.

For SpoofingClient.Poll calls we only log trace of the
final SpoofingClient.Do made.
2019-02-25 10:40:48 -08:00
Markus Thömmes 374dc8c6ce Make it possible to use 'IsStatusOK' without parentheses. (#291) 2019-02-22 10:16:47 -08:00
Victor Agababov 4a1fba4148 Add a variant of wait for status with explicit timeout. (#290)
* Add a variant of wait for status with explicit timeout.

This permits setting higher timeouts in the performance tests,
which it seems take longer to come to life.

* revert the default timeout change
2019-02-21 11:09:47 -08:00
Yanwei Guo 1494b24d7f Update OpenCensus Stackdriver exporter version (#280)
* split and update

* bug fixed

* change the copyright year

* use fake metadata in tests

* exclude test coverage for gcp_metadata

* revert 2019 change on existing files
2019-02-20 14:18:46 -08:00
Adriano Cunha b273d660ad Remove usage of K8S_CLUSTER_OVERRIDE (#289)
It was removed in https://github.com/knative/test-infra/pull/481.
2019-02-20 10:17:47 -08:00
mattmoor-sockpuppet 737c4a42f3 golang format tools (#287)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-19 07:12:46 -08:00
mattmoor-sockpuppet d462372eb2 Format markdown (#288)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)`
2019-02-19 06:52:46 -08:00
Matt Moore 729d5ada5f Adapt the spoofing client to take a "FormatLogger" instead of a BaseLogger (#285)
This is a breaking change, that can be fixed up by replacing `logger,` with `logger.Infof,` in the argument lists for these functions.

This is part of a larger cleanup to allow us to use alternate log methods like `t.Logf` in place of `BaseLogger`.
2019-02-18 16:57:45 -08:00
Markus Thömmes eac0dd3596 Add 'MatchesAllOf' to make it possible to combine matchers. (#284) 2019-02-18 14:36:45 -08:00
Victor Agababov 7a5ce38287 Simplify and comment AppenRandomString (#282)
* Simplify and comment AppenRandomString

Port and rewrite the comment from the original.
Remove the sync.Once(). Initializing during package initialization is just as good.
Mutex doesn't have to be a pointer

* remove fancy rnd, remove mutex, add example, which would also check compilation

* actually commit the example

* add licence
2019-02-18 12:26:45 -08:00
Markus Thömmes 93989176e0 Fix range expression in 'IsOneOfStatusCodes' to actually match the codes. (#283) 2019-02-18 08:48:46 -08:00
dushyanthsc ec1c8ea324 Metrics logging fix in pkg/test: Issue-3150 (#279)
* Metrics logging fix in pkg/test: Issue-3150

https://github.com/knative/serving/issues/3150 describes the issue
that currently exists in our test logging framework. This change
fixes the problem by prefixing metrics that needs to be emited by
a constant which the logging.ExpoxtSpan method then uses to identify
the spans that needs to be emitted as logs

Note this only fixes part of the issue:
https://github.com/knative/serving/issues/3150
this change needs to be ported to knative serving before the issue
can be closed.

* Update test/logging/logging.go

Adding required lines.

Co-Authored-By: dushyanthsc <43390008+dushyanthsc@users.noreply.github.com>
2019-02-15 13:36:44 -08:00
Nghia Tran 717a172c91 Helper to call Hijack on a http.ResponseWriter if possible. (#281) 2019-02-15 13:13:44 -08:00
Markus Thömmes f9ede61d88 Add status matchers to help unify test code. (#278)
* Add status matchers to help unify test code.

* Generalize status code matcher to be able to match multiple codes.
2019-02-15 10:38:44 -08:00
Dave Protasowski 0183bf9cdc Drop spec.generation support (#234)
* Drop webhook logic to increment spec.generation

With Kubernetes 1.11+ metadata.generation now increments properly
when the status subresource is enabled on CRDs

For more details see: https://github.com/knative/serving/issues/643

* Drop the generational duck type
2019-02-14 08:29:45 -08:00
Dave Protasowski 829b886f7e Don't close the http.Request body (#277)
As per net.http package for `http.Request.Body`

```
        // The Server will close the request body. The ServeHTTP
        // Handler does not need to.
```
2019-02-14 07:01:44 -08:00
mattmoor-sockpuppet d9eb9772e8 golang format tools (#276)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-13 08:29:42 -08:00
Victor Agababov 1982208dd9 Initial commit for the webhook to set the annotations about mutator. (#275)
* Initial commit for the webhook to set the annotations about mutator.

The user that created or updated the resource will be set in the
annotations.

* update comments

* remove debug logging

* logging :/

* logging :/, returns

* logging :/ III

* error wrap

* simplify test

* rename the test

* add pkg/errors to the deps for better errors

* do not require CRD to implement Annotatable

* review issues

* fix interface as required by review
2019-02-12 21:03:43 -08:00
Leonardo Rossetti c089ddfc5d test/helpers module to store AppendRandomString helper fn (#256)
* test/helpers module to store AppendRandomString helper fn

* defer unlock
2019-02-12 12:10:43 -08:00
Victor Agababov dc1adcf1df Cleanup the webhook code. (#272)
* Cleanup the webhook code.

- add more tests
- fix formatting
- fix logging and errors
- use shorthands
- some optimizations in types
- make code more Go'ey from C'ey.

* raise test coverage
2019-02-12 09:12:44 -08:00
Markus Thömmes 00226b3943 Add ping message verification to the websocket connection. (#269)
* Add ping message verification to the websocket connection.

* Recycle ticker.

* Add comment.

* Fix datarace by waiting for goroutines to finish on Shutdown.
2019-02-12 09:05:43 -08:00
Victor Agababov ac1f818227 remove the redundant receiver (#271) 2019-02-11 13:39:42 -08:00
mattmoor-sockpuppet f2217df097 golang format tools (#270)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-11 06:37:43 -08:00
Victor Agababov 5db4e8e38e Clean test loggers (#266)
* fix very annoying logging in the integration tests

* Add clean test loggers method.

This would help us run the tests over-and-over again.
Currently the test hogs `t` and that object is not reusable.
2019-02-10 08:13:42 -08:00
Gregory Haynes b670fe05a9 Add static endpoint override to test/spoof (#143)
* Add static endpoint override to test/spoof

When testing locally its common to use a cluster which both does not
have resolvable dns for ksvcs and does not have public IPs. Support
overriding the endpoint for knative's ingress controller to a static
value which can be set to e.g. the knative-ingressgateway nodeport.

* Fix 2 broken links
2019-02-08 19:17:41 -08:00
Adriano Cunha 92212a7050 Update test-infra (#265)
Major change: new markdown link checker.
2019-02-08 18:36:41 -08:00
Scott Weiss 9f2cabc25b allow overriding spoofed gateway name/namespace (#260)
Signed-off-by: Scott Weiss <sdw35@cornell.edu>
2019-02-08 10:15:41 -08:00
Markus Thömmes 3df885a8fc Hardening the websocket client. (#262)
* Cleanup websocket connection, actually test reconnects.

* Some more cleanup.

* Locally define connFactory to avoid races.

* Move locks around, harden test.

* Add logging.

* Drop redundant target.

* Move message encoding outside of the writerLock.

* Fix assignment nit.

* Remove named return value.

* Add close signal to long-running loops.

* Add todo for returning a messageType.

* Bump header to 2019.

* Add note on draining the messageChan.

* Drop target from signature.

* Drop target from test.

* Add a more speaking example to draining the messageChan.

* Fix typo.

* Relax read lock, improve test.

* Bump test coverage.

* Add double shutdown test.

* Remove code duplication in test.
2019-02-08 09:51:41 -08:00
Victor Agababov bd5a391c64 fix very annoying logging in the integration tests (#264) 2019-02-07 14:55:40 -08:00
mattmoor-sockpuppet 4f143e6ce3 golang format tools (#263)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-02-07 08:17:41 -08:00
Adam Harwayne 25b3f456f0 Webhook creates a patch for all fields generated by Go (#243)
* Webhook creates a patch for all fields generated by round tripping the JSON through Golang types.

* Add unit tests for InnerDefaultResource.

* Linter errors.

* PR comments - test changes

* t.Helper()

* PR comments.
2019-02-06 14:32:40 -08:00
Victor Agababov 267197692a Use the k8s sets for the code that is actually set of strings (#261) 2019-02-04 14:35:41 -08:00
Matt Moore 18a6804326 Wait for work to complete before returning from Run. (#259)
Partially addresses https://github.com/knative/serving/issues/3074
2019-02-03 09:40:39 -08:00