Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid panic on bad Kong config #338

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

javierguerragiraldez
Copy link
Collaborator

if the Kong client fails to connect correctly, the RunWhenEnterprise function panics when reading the (missing) configuration.

Since this is a common failure in CI tests, this PR adds sanity tests to avoid the panic and get better failure logs.

if the Kong client fails to connect correctly, the RunWhenEnterprise
function panics when reading the (missing) configuration.

Since this is a common failure in CI tests, this PR adds sanity
tests to avoid the panic and get better failure logs.
@javierguerragiraldez javierguerragiraldez requested a review from a team as a code owner June 6, 2023 08:04
@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2023

Codecov Report

Patch coverage: 38.46% and project coverage change: -0.03 ⚠️

Comparison is base (9bc15b0) 52.75% compared to head (3a2a1ff) 52.73%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #338      +/-   ##
==========================================
- Coverage   52.75%   52.73%   -0.03%     
==========================================
  Files          69       69              
  Lines        5093     5103      +10     
==========================================
+ Hits         2687     2691       +4     
- Misses       1832     1836       +4     
- Partials      574      576       +2     
Flag Coverage Δ
2.1.4 36.09% <0.00%> (-0.08%) ⬇️
2.2.1.3 ?
2.2.2 36.09% <0.00%> (-0.08%) ⬇️
2.3.3 36.25% <0.00%> (-0.08%) ⬇️
2.3.3.4 47.30% <38.46%> (-0.02%) ⬇️
2.4.1 36.33% <0.00%> (-0.08%) ⬇️
2.4.1.3 47.38% <38.46%> (-0.02%) ⬇️
2.5.1.2 47.38% <38.46%> (-0.02%) ⬇️
2.5.2 36.33% <0.00%> (-0.08%) ⬇️
2.6.1 36.33% <0.00%> (-0.08%) ⬇️
2.6.1.0 47.38% <38.46%> (-0.02%) ⬇️
2.7.2 36.33% <0.00%> (-0.08%) ⬇️
2.7.2.0 48.91% <38.46%> (-0.02%) ⬇️
2.8.3 36.33% <0.00%> (-0.08%) ⬇️
2.8.4.0 48.91% <38.46%> (-0.02%) ⬇️
3.0.2 35.78% <0.00%> (-0.08%) ⬇️
3.0.2.0 49.36% <38.46%> (-0.02%) ⬇️
3.1.1 37.27% <0.00%> (-0.08%) ⬇️
3.1.1.3 50.95% <38.46%> (-0.03%) ⬇️
3.2.2 37.33% <0.00%> (-0.08%) ⬇️
3.2.2.1 50.95% <38.46%> (-0.03%) ⬇️
community 37.87% <0.00%> (-0.08%) ⬇️
enterprise 51.49% <38.46%> (-0.03%) ⬇️
enterprise-nightly 50.95% <38.46%> (-0.03%) ⬇️
integration 52.73% <38.46%> (-0.03%) ⬇️
nightly 37.33% <0.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
kong/test_utils.go 51.53% <38.46%> (-0.97%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@javierguerragiraldez
Copy link
Collaborator Author

depends on #337 to fix (remove) the depguard linter. until that, no PR is likely to pass.

Copy link
Contributor

@rainest rainest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not just

rawConfiguration, ok := info["configuration"]
if !ok {
    t.Fatal("could not retrieve Kong configuration")
}
configuration := rawConfiguration.(map[string]interface{})

as a simpler approach? It seems like the first will imply the latter two are also going to fail.

That aside, what's happening here where this isn't failing earlier? Shouldn't we get some failure after the client request? Are we getting some issue where the root responds successfully, but with an empty response?

@javierguerragiraldez
Copy link
Collaborator Author

as a simpler approach? It seems like the first will imply the latter two are also going to fail.

yes, that should work too

That aside, what's happening here where this isn't failing earlier?

not sure how it happens, but it does. my guess is that sometimes kong isn't correctly loaded by the GiHub actions and the connection handshake doesn't complete. the logs definitely point to a panic that happens here when there's no configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants