Skip to content

Run mixed mode tests in a workflow, and publish results to release notes - #3166

Merged
ScottDugas merged 16 commits into
FoundationDB:mainfrom
ScottDugas:record-good-bad-versions
Feb 17, 2025
Merged

ScottDugas merged 16 commits into
FoundationDB:mainfrom
ScottDugas:record-good-bad-versions

Conversation

@ScottDugas

@ScottDugas ScottDugas commented Feb 14, 2025 •

Copy link
Copy Markdown
Collaborator

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.yamsql is set to !supported_version: 4.1.6.0 because that support only exists in 4.1.6.0, but it was also added to 4.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):

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

See full test run

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.
Comment on lines +129 to +131
// 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment on lines +70 to +80
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:])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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)

Comment thread yaml-tests/yaml-tests.gradle Resolved
Comment thread .github/workflows/mixed_mode_test.yml Resolved
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])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

(See full test)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

See full test run

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread publish-mixed-mode-results.py Resolved
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.
@ScottDugas
ScottDugas marked this pull request as ready for review February 17, 2025 13:09
Comment on lines +129 to +131
// 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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread .github/workflows/mixed_mode_test.yml Resolved
Comment thread .github/workflows/mixed_mode_test.yml Outdated
gradle_command: mixedModeTest
gradle_args: -PreleaseBuild=false -PpublishBuild=false
- name: Update release notes
run: python build/publish-mixed-mode-results.py

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is missing a bunch of arguments

Comment thread publish-mixed-mode-results.py Resolved
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])

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

See full test run

Comment on lines +70 to +80
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:])

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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") {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread yaml-tests/yaml-tests.gradle Resolved
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])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Comment on lines +70 to +80
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:])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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
@ScottDugas
ScottDugas merged commit f21456b into FoundationDB:main Feb 17, 2025
@ScottDugas ScottDugas added build improvement Improvement to the build system testing improvement Change that improves our testing labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build improvement Improvement to the build system testing improvement Change that improves our testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants