Commit Graph

2 Commits

Author SHA1 Message Date
Jorge Turrado Ferrero b5c41c8c2a
chore: add golangci-lint (#584) 2023-01-27 08:52:15 +01:00
Aaron Schlesinger 6b8d4ab8aa
Refactoring the interceptor (#105)
* Refactoring the interceptor

- Adding more testing to the proxy
- Refactoring the proxy to use standard net/http (gives it more control over the response lifecycle)
- Using the standard library test framework, because stretchr/testify/suite was not adding much (stretchr/testify/require is still in use though)

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding test for holding the connection

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing dead code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing dead code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* using the getter/watcher logic in the proxy handler

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* progress on fast getter/watcher implementation:

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding deployment cache

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding a backoff for the network connection

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding test targets to the magefile

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Fixing and adding more tests to the proxy

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Adding test to ensure proxy handler holds until >0 replicas on target deployment

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* refactoring in progress and more tests

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* todo test

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* fixing hanging issue

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding test for slow origin, and a TODO in the proxy tests

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* TODO tests

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* more work on connection retry and backoff

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* logging nested errors

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* better test checks and explanatory comments

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* moving sumExp utility function to top

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding tests for DialContextWithRetry

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* refactoring backoff etc...

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* refactoring the dialer

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* refactoring if/else multiple return statements

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing addition from num steps

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing dead code and updating knative attribution comment

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* removing net error type check

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding one more test

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* implementing TODO tests and cleaning up unused and logging code

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding wait func timeout

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding waitFunc timeout logic

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* starting tests for the deployment cache

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding deployment cache watch test

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* adding timing checks to the deployment cache test

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Fixing the last broken test

Turns out, don't run a handler in a goroutine because (net/http/httptest).ResponseRecorder
is not concurrency-safe. Thanks to @asw101 and @khaosdoctor for help on this!

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* Tidying up interceptor config and making operator set more config vars

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>

* fixing tests and compile errs

Signed-off-by: Aaron Schlesinger <aaron@ecomaz.net>
2021-04-12 12:48:07 -07:00