Repository navigation
Run mixed mode tests in a workflow, and publish results to release notes - #3166
Conversation
When debugging the tests, if you stop it sends SIGKILL, which kills the test process, but not any of the child processes. This means that when you restart the tests they'll fail, because the ports are taken. We could have it dynamically generate ports, but that would most likely lead to developers having hundreds of servers running. Instead, this code, at startup will find all running servers and kill them.
This allows running the mixed-mode tests against a bunch of versions. It is currently set to the 50 most up-to-date versions (based on version ordering, not publish date). That being said, builds older than 4.0.559.0 did not publish a server, so we can't test against anything older than that. I chose the 50 pretty arbitrarily, we can adjust as time goes on. I wanted to also check the `Build-Date` but it appears that is not getting correctly filled in.
This will allow us to parse the results of the various versions, and present them.
…ase notes This should, at some point, be connected to the release workflow, but I'm not doing that, and I think it might always be good to be able to re-run this independently of doing a release.
| // It looks like `Build-Date` is not currently being included, if we had that we could guarantee the last | ||
| // x weeks of builds. There may need to be some ways to handle the fact that built date may not be consistent | ||
| // with the ordering of the versions |
There was a problem hiding this comment.
Your comment already alludes to this, but I think Build-Date isn't quite right, because version order isn't the same as semantic order due to patch versions. I could see us wanting something like the last 30 days of un-patched versions (that is, x.y.z.0) plus any patches off of those, maybe? The alternative would be a purely semantic test like "all builds from this minor version and the last one"
There was a problem hiding this comment.
Yeah, without Built-Date, there's not really much to be done, we can't make any decisions about anything that has been released.
Since we don't have that, I just stuck with the last 50 builds (by version). There are about ~20 builds going back to the first server, so, we'll see.
My current thinking is that yes, we would want everything from the last 30 days. This may require us to fetch the last 100 by version, and reject anything that is over 30 days ago to catch up patch releases. With a minimum of the last x most recent versions. Trying to make sure that we will publish compatibility for all releases in the last 30 days, and at least the last 10 releases.
| // 4.0.559.0 is the first version that introduced the server, so we won't be able to find anything | ||
| // older than that. Eventually we can remove this check because we'll be long enough away in terms of versions | ||
| // and times. | ||
| if (attributes.version == "4.0.559.0") { |
There was a problem hiding this comment.
I believe there are changes missing in versions >= 4.0.559.0 and < 4.0.559.3 that make those unlikely to be able to pass (e.g., #3058), and there are some 4.1 builds that won't have those either. I suppose that should just show up in the results, in that it will be presented as mixed-mode failures between, say, 4.1.6.0 and 4.0.561.0, but that could also be misleading as those errors are more like testing artifacts than anything else. I think the alternative is to have something like an "LTS" system, where we bless certain versions as supporting upgrades, and then testing those explicitly, rather than being exhaustive here.
There was a problem hiding this comment.
They end up passing with what is in main. I believe that's because at least some of those changes are for tests that are flagged with a !supported_version, see my previous comment.
Having an LTS system seems excessive at this point.
There was a problem hiding this comment.
Is part of the problem that it's not running with continuations, so it's not actually doing much mixedness? It probably can't quite run with forced continuations at the moment, but maybe it should?
There was a problem hiding this comment.
The problem, I think, is that every test that would fail with those versions is disabled.
I just created a draft PR that enables all yaml tests: #3169
It almost feels like we need something different in the yaml files that indicates that we are knowingly breaking backwards compatibility, that is allowed in PRB and releases, but breaks here.
| with open(filename, 'r') as fin: | ||
| lines = fin.read().split('\n') | ||
| i = 0 | ||
| target = '<!-- MIXED_MODE_RESULTS ' + version + ' PLACEHOLDER -->' | ||
| while i < len(lines) and not lines[i].startswith(target): | ||
| i+= 1 | ||
| if i == len(lines): | ||
| raise Exception('Could not find placeholder in release notes file') | ||
| return '\n'.join(lines[:i] | ||
| + [markdown] | ||
| + lines[i+1:]) |
There was a problem hiding this comment.
As written, if someone runs this multiple times, it will add the mixed-mode results multiple times. Which, may work, if the idea is that we'll run this at the end of the release process or something. I think the alternative would be to introduce 2 new placeholders, one for start and one for end, and then replace the contents between start and end in this method. So, if we run the same tag multiple times, we get fresh mixed mode results here, overwriting previous results
There was a problem hiding this comment.
As it is, if you run this multiple times, the second time it will fail.
It replaces the placeholder as it is, and then you have results, so the next time it runs it will fail to find the placeholder.
Given that it checks out the tag to run the tests, it should get the same results a second time, so I didn't see much point in having it be able to update the results.
We could still update them if we need to, by putting the placeholder back manually.
There was a problem hiding this comment.
Yeah, I'm not sure I see re-runnability to be a strict requirement either. It should be workable if we can only run it once, though I am trying to figure out how this works together with documentation publishing. In particular, in the PR I have to use Sphinx, I also have it update the documentation with Javadoc comments. Because the release notes are included in the documentation, to get this to correctly publish, I think it may need to something like combine the release notes from one commit with the javadoc from another. Or we need to remove this as a separate workflow and add this to the release workflow. Or we need to commit to using GitHub releases and have this update the GitHub release contract instead.
There was a problem hiding this comment.
If we don't decide to use GitHub releases, would it make sense/be possible to have this just update the documentation directly?
(I'm assuming that this is not a request to make further changes in this PR, but musing about how we're going to combine the documentation publishing and this in the future)
| sorted_keys = sorted(results.keys(), key=lambda raw: [int(part) for part in raw.split('.')]) | ||
|
|
||
| return header_size + " Mixed Mode Tested against \n" + \ | ||
| ', '.join([emoji(results[version]) + '`' + version + '`' for version in sorted_keys]) |
There was a problem hiding this comment.
I have a few formatting quibbles here. It feels like the results should be grouped by result, and then each result value displayed on its own line, and then maybe a brief line should be inserted between the header and the results. So, something like:
#### Mixed Mode Test Results
Mixed mode testing run against the following previous versions:
* ✅ `4.0.559.4`, `4.1.4.0`, `4.1.5.0`
* ❌ `4.0.559.0`, `4.0.559.1`, `4.0.559.3`, `4.0.560.0`, `4.0.575.0`
([See full test](blah))
Which would then display as:
Mixed Mode Test Results
Mixed mode testing run against the following previous versions:
- ✅
4.0.559.4,4.1.4.0,4.1.5.0- ❌
4.0.559.0,4.0.559.1,4.0.559.3,4.0.560.0,4.0.575.0
There was a problem hiding this comment.
Yeah, I could see that being better, I didn't have a sample before, but just added one to the PR description, with what it was producing.
I feel like having it broken down by result might actually be harder to parse, since most people are going to be looking for the version they have, and having it split would require scanning two lists.
I do like the change in wording for the header.
Mixed Mode Test Results
Mixed mode testing run against the following previous versions:
✅4.0.559.1, ✅4.0.559.2, ✅4.0.559.3, ✅4.0.559.4, ❌4.0.561.0, ✅4.0.562.0, ✅4.0.564.0, ✅4.0.565.0, ✅4.0.566.0, ✅4.0.567.0, ✅4.0.568.0, ✅4.0.569.0, ✅4.0.570.0, ✅4.0.571.0, ✅4.0.572.0, ✅4.0.573.0, ✅4.0.574.0, ✅4.0.575.0, ✅4.1.4.0, ✅4.1.5.0, ✅4.1.6.0
There was a problem hiding this comment.
Should there be an additional newline after versions: (or perhaps a <br/>)? I believe Markdown won't introduce a break to follow the newline (except, unfortunately, in some select scenarios including PR comments), so previous versions: will display on the same line as versions list.
There was a problem hiding this comment.
Yeah, in my tests it worked, but if GitHub is inconsistent, I don't mind an extra blank line. I think the extra blank line is what it's supposed to do.
Slight conflict in ExternalServer, but I'm not sure what changed on this branch, just took main.
We need to checkout main so that we can commit and push, rather than pushing to the tag
There were some meta comments about !supported_version, that I didn't want to bring in here, but that does need to logically be reworked, at least a bit. I also didn't completely apply the reformatting changes, and responded in the PR comments.
| // It looks like `Build-Date` is not currently being included, if we had that we could guarantee the last | ||
| // x weeks of builds. There may need to be some ways to handle the fact that built date may not be consistent | ||
| // with the ordering of the versions |
There was a problem hiding this comment.
Yeah, without Built-Date, there's not really much to be done, we can't make any decisions about anything that has been released.
Since we don't have that, I just stuck with the last 50 builds (by version). There are about ~20 builds going back to the first server, so, we'll see.
My current thinking is that yes, we would want everything from the last 30 days. This may require us to fetch the last 100 by version, and reject anything that is over 30 days ago to catch up patch releases. With a minimum of the last x most recent versions. Trying to make sure that we will publish compatibility for all releases in the last 30 days, and at least the last 10 releases.
| gradle_command: mixedModeTest | ||
| gradle_args: -PreleaseBuild=false -PpublishBuild=false | ||
| - name: Update release notes | ||
| run: python build/publish-mixed-mode-results.py |
There was a problem hiding this comment.
This is missing a bunch of arguments
| sorted_keys = sorted(results.keys(), key=lambda raw: [int(part) for part in raw.split('.')]) | ||
|
|
||
| return header_size + " Mixed Mode Tested against \n" + \ | ||
| ', '.join([emoji(results[version]) + '`' + version + '`' for version in sorted_keys]) |
There was a problem hiding this comment.
Yeah, I could see that being better, I didn't have a sample before, but just added one to the PR description, with what it was producing.
I feel like having it broken down by result might actually be harder to parse, since most people are going to be looking for the version they have, and having it split would require scanning two lists.
I do like the change in wording for the header.
Mixed Mode Test Results
Mixed mode testing run against the following previous versions:
✅4.0.559.1, ✅4.0.559.2, ✅4.0.559.3, ✅4.0.559.4, ❌4.0.561.0, ✅4.0.562.0, ✅4.0.564.0, ✅4.0.565.0, ✅4.0.566.0, ✅4.0.567.0, ✅4.0.568.0, ✅4.0.569.0, ✅4.0.570.0, ✅4.0.571.0, ✅4.0.572.0, ✅4.0.573.0, ✅4.0.574.0, ✅4.0.575.0, ✅4.1.4.0, ✅4.1.5.0, ✅4.1.6.0
| with open(filename, 'r') as fin: | ||
| lines = fin.read().split('\n') | ||
| i = 0 | ||
| target = '<!-- MIXED_MODE_RESULTS ' + version + ' PLACEHOLDER -->' | ||
| while i < len(lines) and not lines[i].startswith(target): | ||
| i+= 1 | ||
| if i == len(lines): | ||
| raise Exception('Could not find placeholder in release notes file') | ||
| return '\n'.join(lines[:i] | ||
| + [markdown] | ||
| + lines[i+1:]) |
There was a problem hiding this comment.
As it is, if you run this multiple times, the second time it will fail.
It replaces the placeholder as it is, and then you have results, so the next time it runs it will fail to find the placeholder.
Given that it checks out the tag to run the tests, it should get the same results a second time, so I didn't see much point in having it be able to update the results.
We could still update them if we need to, by putting the placeholder back manually.
| // 4.0.559.0 is the first version that introduced the server, so we won't be able to find anything | ||
| // older than that. Eventually we can remove this check because we'll be long enough away in terms of versions | ||
| // and times. | ||
| if (attributes.version == "4.0.559.0") { |
There was a problem hiding this comment.
They end up passing with what is in main. I believe that's because at least some of those changes are for tests that are flagged with a !supported_version, see my previous comment.
Having an LTS system seems excessive at this point.
| sorted_keys = sorted(results.keys(), key=lambda raw: [int(part) for part in raw.split('.')]) | ||
|
|
||
| return header_size + " Mixed Mode Tested against \n" + \ | ||
| ', '.join([emoji(results[version]) + '`' + version + '`' for version in sorted_keys]) |
There was a problem hiding this comment.
Should there be an additional newline after versions: (or perhaps a <br/>)? I believe Markdown won't introduce a break to follow the newline (except, unfortunately, in some select scenarios including PR comments), so previous versions: will display on the same line as versions list.
| with open(filename, 'r') as fin: | ||
| lines = fin.read().split('\n') | ||
| i = 0 | ||
| target = '<!-- MIXED_MODE_RESULTS ' + version + ' PLACEHOLDER -->' | ||
| while i < len(lines) and not lines[i].startswith(target): | ||
| i+= 1 | ||
| if i == len(lines): | ||
| raise Exception('Could not find placeholder in release notes file') | ||
| return '\n'.join(lines[:i] | ||
| + [markdown] | ||
| + lines[i+1:]) |
There was a problem hiding this comment.
Yeah, I'm not sure I see re-runnability to be a strict requirement either. It should be workable if we can only run it once, though I am trying to figure out how this works together with documentation publishing. In particular, in the PR I have to use Sphinx, I also have it update the documentation with Javadoc comments. Because the release notes are included in the documentation, to get this to correctly publish, I think it may need to something like combine the release notes from one commit with the javadoc from another. Or we need to remove this as a separate workflow and add this to the release workflow. Or we need to commit to using GitHub releases and have this update the GitHub release contract instead.
| gradle_command: mixedModeTest | ||
| gradle_args: -PreleaseBuild=false -PpublishBuild=false | ||
| - name: Checkout Main | ||
| run: git checkout main |
There was a problem hiding this comment.
Did you get a chance to test this? I believe when I tried to do something similar with a test repo, the equivalent step here failed with a "reference not found", and I needed to: (1) checkout main as the first step, (2) call checkout again to switch to the actual target, and (3) checkout origin/main instead of main
There was a problem hiding this comment.
I have a test repo, I will iterate, and update when I've validated.
At the moment, it appears that it needs to fetch the tags too.
There was a problem hiding this comment.
I ran it through the test repo, and got a passing build that updated the release notes as expected.
1. We need to fetch main 2. the script was not in the right path
This adds a workflow to run the yaml-tests at a given tag against the last 50 releases, and adds the results to
docs/ReleaseNotes.md.Note: Currently it will only download back to
4.0.559.1, because older builds didn't have a server to do mixed-mode testing against.Currently this is a manual workflow that someone would run after a successful build, but once proven, we can change it to automatically run after a release.
There is some discussion in @alecgrieser's review, but I will also point out here that the results are somewhat weakened by the use of
!supported_version. For example,prepared.yamsqlis set to!supported_version: 4.1.6.0because that support only exists in4.1.6.0, but it was also added to4.0.559.6(which was released after the test run in the sample below). We also have issues where the behavior may change between two versions. None of that is visible here, and would have to be noted in the release notes, and found there. But hopefully the fact that we run single version mixed-mode tests during PRB and release will prevent issues from completely slipping through.Sample output (an actual run, but the link is to a different workflow):