You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4213128
Browse filesBrowse the repository at this point in the historyBrowse files
External Scaler: strengthen the connection pool tests and pin the TLS error path (#8213)
* External Scaler: strengthen the connection pool tests and pin the TLS error path
Follow-up to #8193, addressing the review points left open at merge.
Look the pooled connection up by its key. The tests found their entry by
scanning connectionPool for a connectionGroup with an expected refCount,
which matches any entry in a pool shared by the whole package, so a test
could pass on a connection another test created. getConnectionPoolKey
gives each test the key it built with, and poolEntryFor loads that entry
directly.
Release each scaler on test cleanup. Every test relied on its own Close
calls to leave the pool empty, so a test failing part way through left an
entry behind for the tests that follow. Close is idempotent, so a cleanup
Close after an explicit one is a no-op.
Cover the push scaler. NewExternalPushScaler acquires a share of the same
pool and externalPushScaler takes Close from the externalScaler it embeds,
neither of which was exercised. The new test also shares one connection
between a push scaler and a plain scaler on the same address.
Pin where a TLS error is reported. The pooled connection is now built from
the scaler constructor, so an unparseable client certificate is reported
there rather than on the first poll. buildScalers turns a constructor
error into a failure for the whole ScaledObject, so this moves a malformed
certificate from degrading one trigger at poll time to failing every
trigger on the object at build time. The test records that behaviour so a
change to it is deliberate, and checks the failed construction leaves
nothing in the pool.
Signed-off-by: Harsh Raj <harshrajdebug@gmail.com>
* External Scaler: clean up TCP test scalers and drop a lookup that cannot match
Register cleanup for the scalers the TCP test builds, as the pool tests
already do, so a test that fails part way through does not leave its
pooled connection behind for the tests that follow.
Drop the poolEntryFor check from the TLS test. The pool key includes the
TLS fields, and poolEntryFor builds its key from the address alone, so it
can never find an entry left by the failed construction. The poolEntries
count next to it is what catches that case.
Signed-off-by: Harsh Raj <218219077+harshrajdebug@users.noreply.github.com>
* External Scaler: close the scaler if the TLS test's constructor succeeds
Keep the scaler the TLS test builds and register its cleanup before
failing, so a constructor that wrongly succeeds does not leave a live
scaler and its pooled connection behind for the tests that follow.
Signed-off-by: Harsh Raj <harshrajdebug@gmail.com>
---------
Signed-off-by: Harsh Raj <harshrajdebug@gmail.com>
Signed-off-by: Harsh Raj <218219077+harshrajdebug@users.noreply.github.com>
0 commit comments