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

[CI] Add Legacy Integration Test Workflow #1122

Merged
merged 19 commits into from
Mar 24, 2021
Merged

[CI] Add Legacy Integration Test Workflow #1122

merged 19 commits into from
Mar 24, 2021

Conversation

shaneutt
Copy link
Contributor

@shaneutt shaneutt commented Mar 23, 2021

This adds our new integration tests to the existing v1.x KIC controller so that every PR tests v1 and v2 until we fully transition to ensure compatibility and help protect against regressions.

Resolves #1040

NOTE: you'll specifically see this line when legacy tests are triggered versus mainline:

WARNING: deploying legacy Kong Kubernetes Ingress Controller (KIC)

ANOTHER NOTE: this PR co-opted the existing hack which runs the controller manager as an exec.Command in the test suite, this has been done intentionally for speed and the follow up to improve this before GA is #1128.

This expands on the existing hack which runs the controller
for integration tests by making it capable of running the
legacy (v1.x) version of the controller as well. This is
needed in the interim between v1.x and v2.x so that all of
the integration tests run (and must pass) on both versions
to reduce the risk of regressions in controller functionality.
@shaneutt shaneutt added this to the KIC 2.0-preview.1 milestone Mar 23, 2021
@shaneutt shaneutt self-assigned this Mar 23, 2021
@codecov
Copy link

codecov bot commented Mar 23, 2021

Codecov Report

Merging #1122 (b5fac77) into next (552f9ee) will increase coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #1122      +/-   ##
==========================================
+ Coverage   57.13%   57.23%   +0.09%     
==========================================
  Files          34       34              
  Lines        3278     3278              
==========================================
+ Hits         1873     1876       +3     
+ Misses       1266     1264       -2     
+ Partials      139      138       -1     
Impacted Files Coverage Δ
pkg/parser/parser.go 83.91% <0.00%> (+1.30%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 552f9ee...b5fac77. Read the comment docs.

@shaneutt shaneutt linked an issue Mar 23, 2021 that may be closed by this pull request
We were running redundant test runs on every PR, so this change
provides more targeting configuration which will reduce the excess.
@shaneutt shaneutt marked this pull request as ready for review March 23, 2021 17:15
@shaneutt shaneutt requested a review from a team as a code owner March 23, 2021 17:15
Comment on lines +60 to -69
if resp.StatusCode == http.StatusOK {
// now that the ingress backend is routable, make sure the contents we're getting back are what we expect
// Expected: Welcome to nginx!
b := new(bytes.Buffer)
b.ReadFrom(resp.Body)
return strings.Contains(b.String(), "Welcome to nginx!")
}
return false
}, ingressTimeout, ingressTimeoutTick)

// now that the ingress backend is routable, make sure the contents we're getting back are what we expect
// Expected: Welcome to nginx!
resp, err := http.Get(fmt.Sprintf("%s/nginx", u.String()))
assert.NoError(t, err)
b := new(bytes.Buffer)
b.ReadFrom(resp.Body)
assert.Contains(t, b.String(), "Welcome to nginx!")

Copy link
Contributor Author

@shaneutt shaneutt Mar 24, 2021

Choose a reason for hiding this comment

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

This change and the related one below add a fix for a race condition wherein it appears (this is just a theory, I have not dug deeply into this yet) "200 OK" responses from the Kong proxy can return with an empty body for some sub-second period when routes are updated due to ingress changes.

.github/workflows/integration_test.yaml Show resolved Hide resolved
.github/workflows/integration_test_legacy.yaml Outdated Show resolved Hide resolved
railgun/test/integration/suite_test.go Outdated Show resolved Hide resolved
railgun/test/integration/suite_test.go Outdated Show resolved Hide resolved
railgun/test/integration/suite_test.go Outdated Show resolved Hide resolved
scripts/railgun-integration-tests.sh Outdated Show resolved Hide resolved
.github/workflows/integration_test_legacy.yaml Outdated Show resolved Hide resolved
railgun/test/integration/suite_test.go Show resolved Hide resolved
.github/workflows/integration_test_legacy.yaml Outdated Show resolved Hide resolved
@shaneutt shaneutt requested review from mflendrich and a team March 24, 2021 13:57
@shaneutt
Copy link
Contributor Author

The codecov failure has to do with the extra functions added for deploying a controller manager for the tests, BUT we'll be removing that functionality in an upcoming iteration:

#1128

So I would contend we should merge through the failure for now.

CI picked up this data race where the *url.URL that
the test suite waits to publish for the tests to poll.

Was simple, the test suite was just reading from the
pointer after sending it, fixed.
@shaneutt shaneutt requested review from mflendrich and a team March 24, 2021 15:29
@shaneutt shaneutt merged commit dda78cf into next Mar 24, 2021
@shaneutt shaneutt deleted the legacy-integration branch March 24, 2021 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KIC 2.0 - 2.x integration tests also set up to test 1.x
2 participants