go-kong icon indicating copy to clipboard operation
go-kong copied to clipboard

avoid panic on bad Kong config

Open javierguerragiraldez opened this issue 1 year ago • 3 comments

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 avatar Jun 06 '23 08:06 javierguerragiraldez

Codecov Report

Patch coverage: 38.46% and project coverage change: -0.03 :warning:

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%) :arrow_down:
2.2.1.3 ?
2.2.2 36.09% <0.00%> (-0.08%) :arrow_down:
2.3.3 36.25% <0.00%> (-0.08%) :arrow_down:
2.3.3.4 47.30% <38.46%> (-0.02%) :arrow_down:
2.4.1 36.33% <0.00%> (-0.08%) :arrow_down:
2.4.1.3 47.38% <38.46%> (-0.02%) :arrow_down:
2.5.1.2 47.38% <38.46%> (-0.02%) :arrow_down:
2.5.2 36.33% <0.00%> (-0.08%) :arrow_down:
2.6.1 36.33% <0.00%> (-0.08%) :arrow_down:
2.6.1.0 47.38% <38.46%> (-0.02%) :arrow_down:
2.7.2 36.33% <0.00%> (-0.08%) :arrow_down:
2.7.2.0 48.91% <38.46%> (-0.02%) :arrow_down:
2.8.3 36.33% <0.00%> (-0.08%) :arrow_down:
2.8.4.0 48.91% <38.46%> (-0.02%) :arrow_down:
3.0.2 35.78% <0.00%> (-0.08%) :arrow_down:
3.0.2.0 49.36% <38.46%> (-0.02%) :arrow_down:
3.1.1 37.27% <0.00%> (-0.08%) :arrow_down:
3.1.1.3 50.95% <38.46%> (-0.03%) :arrow_down:
3.2.2 37.33% <0.00%> (-0.08%) :arrow_down:
3.2.2.1 50.95% <38.46%> (-0.03%) :arrow_down:
community 37.87% <0.00%> (-0.08%) :arrow_down:
enterprise 51.49% <38.46%> (-0.03%) :arrow_down:
enterprise-nightly 50.95% <38.46%> (-0.03%) :arrow_down:
integration 52.73% <38.46%> (-0.03%) :arrow_down:
nightly 37.33% <0.00%> (-0.08%) :arrow_down:

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%) :arrow_down:

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

codecov-commenter avatar Jun 06 '23 08:06 codecov-commenter

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

javierguerragiraldez avatar Jun 06 '23 09:06 javierguerragiraldez

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.

javierguerragiraldez avatar Jun 06 '23 20:06 javierguerragiraldez