Commit Graph

197 Commits

Author SHA1 Message Date
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
Evan Anderson a118428db1 Add support for v0.2 CloudEvents "context attributes". (#248)
* CloudEvents v0.2 support, step 1: interfaces and versioned types.

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Add support for v0.2 event types. (Breaking change in return types!)

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Move DataContentType() to be common across Senders and Receivers.

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Add comment on why test code is commented out.

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Address @vagababov review.

* Add another test case and better cover extensions in handler tests.
2019-02-01 22:23:38 -08:00
Victor Agababov 819ebda80c Add `AtIndex` method to deal to attach index at the current error. (#257)
* Add `AtIndex` method to deal to attach index at the current error.

This is useful when we are dealing with primite leaf list (e.g.
a list of strings).
The alternative are
a) creating dummy error and then executing ViaFieldIndex(), which is
plain ugly
b) implementing Validate() on the primitive type via type aliasing and
then collecting errors, which seems an overkill.

In addition it seems ViaFieldIndex was not covered by unit tests,
so I've added one to take care of that.

* implement suggestions from the review

* cleanup

* cosmetic

* cosmetic
2019-01-31 12:47:38 -08:00
Matt Moore 77b7b13190 Move the defaulting for ConfigMap into our logging library. (#258)
Progress towards: https://github.com/knative/serving/issues/2668
2019-01-30 21:59:37 -08:00
Victor Agababov da039ff041 Some fixes to the event_v01.go file. (#254)
* Some fixes to the event_v01.go file.

Mostly change to the encodeKey to not use pointer to the map.
Some minor readability improvements.

* Fix the comment wording.
2019-01-30 10:40:37 -08:00
Matt Moore 298debc821 Make "Severity: Error" conditions less scary. (#255)
This restores the appearance of "terminal" conditions to what is was prior to the separation of "terminal" and "non-terminal" conditions.

Terminal conditions with an "Error" severity will simply omit the field.

This keeps coming up, and came to a head when both Evan and Ville bugged me about it in the same day.

Fixes: https://github.com/knative/serving/issues/2507
2019-01-29 22:12:37 -08:00
Gregory Haynes 4171d75265 Remove knative-serving in test/kube_checks (#237)
This was hardcoded from when we moved it in from serving - it needs to
be configurable here.
2019-01-29 14:33:37 -08:00
Scott Nichols cc3cc546fe CloudeEvents: Fix a typo in unit test and code. (#252) 2019-01-29 10:25:37 -08:00
Scott Nichols b531944062 integrating exposed some minor issues. fixed. (#251) 2019-01-29 10:00:37 -08:00
Yaron Schneider f9612ef738 Fix json mismatch in istio pkg (#247)
* corrected suffix

* fixed name
2019-01-28 20:51:37 -08:00
Scott Nichols 61acd8a35b Add CloudEvents Client to sdk (#241)
* Add docs to help bootstrap cloud event sdk usage.

* add go markdown label.

* prettier markdown.

* well golang wants tabs but markdown does not i guess so... fight!

* adding me as an owner of this code.

* adding ville to the hook.

* Pushing new client and builder.

* good example of how to use the encoding settings int he builder.

* make it more clear,.

* prep for merge.

* adding tests.

* adding extenion tests.

* adding test for empty original extensions.

* Adding valid builder tests.

* adding client tests.

* Removing encoding from enum names.

* ran prettier.

* fix spacing.

* Update cloudevents/README.md

Co-Authored-By: n3wscott <32305648+n3wscott@users.noreply.github.com>

* Update based on feedback.

* adding builder to new client.

* update producer paragraph.

* trail space.

* trail space.
2019-01-28 20:09:15 -08:00
Matt Moore 8a05c222ab Add an immediate callback for new registrations in Tracker. (#245)
This change adds an immediate callback to the tracker when a key is added to track an entity that previously lacked coverage.

Fixes: https://github.com/knative/serving/issues/2954
2019-01-28 09:30:36 -08:00
Evan Anderson e4ede720f3 CloudEvents v0.2 support, step 1: interfaces and versioned types. (#244)
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
2019-01-28 07:13:36 -08:00
Brad Hoekstra b8c4664801 Don't rate-limit normal events (#242)
* Don't rate-limit normal events

* Fix test - first enqueue is not rate limited
2019-01-25 14:11:34 -08:00
Nghia Tran 994b801b03 No longer use knative-ingressgateway in tests. (#240) 2019-01-25 11:33:34 -08:00
dushyanthsc 776769b499 Fix to add defer Close in Spoof Client zipkin tracing (#238)
Utility method to retrieve zipkin traces had missed a defer Close
cal. This change fixes that
2019-01-24 11:24:34 -08:00
zxxa 8e50d82e5b add namespaces in pkg (#235) 2019-01-22 21:21:33 -08:00
Gregory Haynes 2a1c043ce3 Move crd checks from serving in to test (#236)
These are generally usable test cases for K8s and as such should live in
pkg/test
2019-01-22 14:18:33 -08:00
Victor Agababov a330baa9b0 Grep fix formatting issues (#233)
* Some fixes to the spoof.go and exporter.go

While reviewing some other CL, I saw some avenues for improving
spoof.go, to log the URL that's being fetched, which would help in test
debugging and to use switch construct, rather than nested if's.

While testing the change, I noticed some shifty loggin from the
exporter, so I fixed that as well while I was there.

* Continuation of the previous cleanups.

* Fix the issues with formatting by executing a grep

* and fix compilation error

* lowercase error

* fix the newly changed unit test
2019-01-18 14:33:32 -08:00
mattmoor-sockpuppet af675a517b golang format tools (#232)
Produced via:
  `gofmt -s -w $(find -path './vendor' -prune -o -type f -name '*.go' -print))`
  `goimports -w $(find -name '*.go' | grep -v vendor)`
2019-01-18 07:36:32 -08:00
Markus Thömmes 076ebf4e56 Fix another dependents mutation in the conditions. (#231) 2019-01-17 17:13:31 -08:00
Yanwei Guo 6c8930f27a change project to project_id (#228) 2019-01-17 17:07:31 -08:00
Adriano Cunha d3a9e54be7 Update test-infra (#224)
* Update test-infra

Bring in the latest features and fixes.

Bonus: use default build, unit and integration test runners.

* Update github.com/rogpeppe/go-internal to v1.0.1-alpha.6

This is needed to include the LICENSE file.
The are no changes in the packages used, so this update is safe.
2019-01-16 12:10:33 -08:00
Dave Protasowski cba7bf4a22 conditions implementation no longer mutates the underlying dependents array (#229) 2019-01-16 11:35:31 -08:00
Markus Thömmes 8cb682996f Fix license check for presubmit tests. (#217)
* Fix license check for presubmit tests (should fail).

* Bump dependency on go-internal to include a LICENSE file.

* Taking check_licenses call out of update-deps.sh.
2019-01-14 06:52:30 -08:00
Victor Agababov 225d11cc1a Some fixes to the spoof.go and exporter.go (#223)
* Some fixes to the spoof.go and exporter.go

While reviewing some other CL, I saw some avenues for improving
spoof.go, to log the URL that's being fetched, which would help in test
debugging and to use switch construct, rather than nested if's.

While testing the change, I noticed some shifty loggin from the
exporter, so I fixed that as well while I was there.

* Continuation of the previous cleanups.
2019-01-11 12:13:29 -08:00
Yanwei Guo 1aca435944 Read metrics backend from environment variable (#218)
* add env to set backend

* join two lines
2019-01-10 11:03:42 -08:00
Dave Protasowski d6a2e27f7b 🦆 Duck Typing - add a ConformsToType helper (#220)
* duck typing - add a ConformsToType helper

Unlike VerifyType, ConformsToType will return the following:
- an error when any marshalling/unmarshalling fails
- false when the concrete type does not implement the duck type
- true when the concrete type implements the duck type

* use knative/pkg kmp to handle panics raised by go-cmp
2019-01-09 19:58:42 -08:00
Yanwei Guo b6044a7d17 remove akyyy as owner (#222) 2019-01-09 16:51:42 -08:00
Matt Moore 5f16262578 Change the webhook cert org to knative.dev (#215)
Related: https://github.com/knative/serving/issues/1340
2019-01-09 06:26:42 -08:00
Yanwei Guo 08febf8f13 Change Stackdriver resource type for metrics (#210)
* change resource type

* copied PR #188

* add unit tests

* change Fatal back to Error

* solve comments

* change to use map

* modify tests
2019-01-08 13:14:42 -08:00
Nghia Tran 4365af623c Increase wait time a little bit. (#214)
In some cases, pods have entered 'Terminating' state, and we're only
waiting for K8s to kill the pods which unfortunately could go over the
5 minutes timeout here.
2019-01-08 10:45:41 -08:00
Markus Thömmes 80e5f98294 Add a utility to check against a minimum required version number. (#211)
* Add a utility to check against a minimum required version number.

* Export and rename interface.

* Happy new year.
2019-01-08 10:12:41 -08:00