-
Notifications
You must be signed in to change notification settings - Fork 536
add integration server tests for resources version checks #17312
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
base: main
Are you sure you want to change the base?
Conversation
This is useful when you want to manually inspect the results even on success
This aid troubleshooting as you don't need to look into the upgrade-config.yaml file but the indications are printed with the test
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
This pull request does not have a backport label. Could you fix it @endorama? 🙏
|
This pull request is now in conflicts. Could you fix it @endorama? 🙏
|
Add support for specifying patch versions in upgrade-config.yaml. If a patch version is present will take precedence over it's own minor version, if both are specified. Patch version use is supported in both keys and values. This allows to specify, for example, specific patch versions not triggering a lazy rollover when upgrading to another patch version. Overhauled the comments in upgrade-config.yaml to reflect this new possibilities and clarify how to write the configuration with examples.
Other than usual bug checks we need one more to check for event.success_count
if len(versions) == 2 { // if 2 versions we expect the first to be bugged and the second to be not | ||
return []testStep{ | ||
steps[0], // create | ||
steps[1], // ingest | ||
zeroEventIngestedDocs, | ||
noEventIngestedInMappings, | ||
steps[2], // upgrade | ||
steps[3], // ingest | ||
someEventIngestedDocs, | ||
eventIngestedHasMappings, | ||
} | ||
|
||
} else if len(versions) == 3 { // if 3 versions we expect the first to be bugged on create, the second on upgrade, the third to be not | ||
return []testStep{ | ||
steps[0], // create | ||
steps[1], // ingest | ||
steps[2], // upgrade | ||
steps[3], // ingest | ||
zeroEventIngestedDocs, | ||
noEventIngestedInMappings, | ||
steps[4], // upgrade | ||
steps[5], // upgrade | ||
someEventIngestedDocs, | ||
eventIngestedHasMappings, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely quite flimsy, I think having a way to tell when 1 "cycle" (create / upgrade -> ingest -> others) is done would be best. Perhaps having the cycles manually defined e.g.
[]testCycle{
{
createStep,
ingestStep,
},
{
upgradeStep,
ingestStep,
},
...
}
Or some other way to detect it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are suggesting to not use the buildTestStep
function but create them manually so it's easier to follow the various cycles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad I wasn't clear enough. Creating them manually works, but we can also change how steps are defined in the runner. In the example above, testCycle
is essentially just: type testCycle []testStep
, and demarcates where one version ends and the other starts.
In your case, since you are inserting the steps in between each "cycle", it would be much less flimsy since you can inject the steps at the end of each cycle.
Just an idea, not sure if it would work well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see, I refactored it in a way that I think removes some of the ifs, but did not address this issue directly in 9874d2d
(#17312)
I think there is value in doing something you propose if we decide is something we want to introduce but we should take some time to think the feature through, here I'm only interested in a quick way to have additional steps (we could also extract createStep
and upgradeStep
"builder" functions from the current one, so they are easier to compose, but I considered it out of scope here)
|
||
// this wraps the usual steps build to add additional checks in between. | ||
// Is a bit brittle, maybe we should consider allowing this as a first class citizen. | ||
buildteststepsForBug := func(t *testing.T, versions ech.Versions, config upgradeTestConfig) []testStep { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildteststepsForBug := func(t *testing.T, versions ech.Versions, config upgradeTestConfig) []testStep { | |
buildTestStepsForBug := func(t *testing.T, versions ech.Versions, config upgradeTestConfig) []testStep { |
runner.Run(t) | ||
}) | ||
|
||
t.Run("8.18.2 to 8.18.3", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this includes start
, shouldn't it be "8.16.2 to 8.17.x to 8.18.x"? Also vsCache.GetLatestSnapshot
gets the latest patch for the minor if you specify x.y
, so the description will be inaccurate when new patches come out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I named this after our test cases for this bug. I don't think we want to merge this PR as it is, with all these test cases for all these versions. This is now useful to ensure our fixes are working but I would make it more general if we want to include it as our regular testing.
I think a necessary test case to add is an upgrade test: from the "previous previous" minor (ie in this case 8.16.2) to the previous minor and than to the current minor. Such a test could find issues that only appears with an upgrade, a scenario we don't yet cover.
} | ||
|
||
type checkMappingStep struct { | ||
datastreamname string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datastreamname string | |
dataStreamName string |
t.Log("test failed and cleanup-on-failure is false, skipping cleanup") | ||
} | ||
}) | ||
if *doCleanup { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this works. The doCleanup
is defined in main_test.go
and so is only accessible in test files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does if you run the tests 😅 It's a quick hack for my use case.
Do you think there is value in bringing this to main
? If yes I'll do a proper implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL, my IDE complains that doCleanup
doesn't exist 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's correct I'd say, mine too. I'd expect it's because it doesn't exist if you're running/compiling the go module 😅 it exists if you run the tests because _tests.go
files are included in the compilation.
Finding event.ingested in 8.17.7 already after upgrade from 8.16.2 is expected due to the changes to apm-data between the versions.
Refactor version selection to ease the move to BCs. Don't use vsCache.GetLatestSnapshot as that will change version as we release new ones. These tests are version specific at the moment, so use fixed SNAPSHOT versions
Replace SNAPSHOT versions with BC or released versions. Use SNAPSHOTS for 8.19.0 test as there is no BC version for it yet and we cannot mix releases/BCs and SNAPSHOT versions.
version8190 := ech.NewVersion(8, 19, 0, "SNAPSHOT") // latest 8.19 | ||
version8162 := vsCache.GetLatestVersionOrSkip(t, "8.16.2") | ||
version8177 := vsCache.GetLatestVersionOrSkip(t, "8.17.7") | ||
version8178 := vsCache.GetLatestBCOrSkip(t, "8.17.8") // latest 8.17 as of today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will skip the whole test entirely if the BC does not exist. Since both GetLatestVersionOrSkip
and GetLatestBCOrSkip
are not used currently, you can update them to achieve what you need instead.
Motivation/summary
Add additional integrationservertest for a recent bug affecting some upgrade paths in APM Server.
Checklist
For functional changes, consider:
How to test these changes
Related issues