Skip to content

Conversation

@pgomulka
Copy link
Contributor

@pgomulka pgomulka commented Dec 10, 2019

Multiple version ranges are allowed to be used in section skip in yml
tests. This is useful when a bugfix was backported to latest versions
and all previous releases contain a wire breaking bug.
examples:
6.1.0 - 6.3.0, 6.6.0 - 6.7.9, 7.0 -
- 7.2, 8.0.0 -

Multiple version ranges are allowed to be used in section skip in yml
tests. This is useful when a bugfix was backported to latest versions
and all previous releases contain a wire breaking bug.
examples:
6.1.0 - 6.3.0, 6.6.0 - 6.7.9, 7.0 -
- 7.2, 8.0.0 -
@pgomulka pgomulka added the :Delivery/Build Build or test infrastructure label Dec 10, 2019
@pgomulka pgomulka self-assigned this Dec 10, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Build)

this.lowerVersion = versions[0];
this.upperVersion = versions[1];
this.versionRanges = parseVersionRanges(versionRange);
assert versionRanges.size() >= 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would this be clearer?

Suggested change
assert versionRanges.size() >= 1;
assert versionRanges.isEmpty() == false;

&& currentVersion.onOrBefore(upperVersion);
boolean skip = false;
for (VersionRange versionRange : versionRanges) {
skip |= versionRange.contain(currentVersion);
Copy link
Contributor

Choose a reason for hiding this comment

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

What about:

boolean skip = versionRanges.stream().anyMatch(range -> range.contain(currentVersion));

return skip || Features.areAllSupported(features) == false;

String[] ranges = rawRanges.split(",");
List<VersionRange> versionRanges = new ArrayList<>();
for (String rawRange : ranges) {
String[] skipVersions = wrapWithSpaces(rawRange).split("-");
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why wrapWithSpaces is necessary here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, it's to ensure you get two elements in the skipVersions array. That's a little subtle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, definitely not needed.

Copy link
Contributor Author

@pgomulka pgomulka Dec 10, 2019

Choose a reason for hiding this comment

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

@pugnascotia ok so I see why I put that there. I wanted to allow formats like
8.0.0 - where there is no additional space. Also didn't want to make it a special case.
how about using "8.0.0 -".split("-",-1) ? -1 there means that the length of array element can have any element. With 0 it means that trailing empty element will not be returned

return upper;
}

public boolean contain(Version currentVersion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

...I don't suppose you'd rename this to contains? It's just that I'm so used to Collection.contains 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is a good idea, will do

this.upper = upper;
}

public Version lower() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we not usually use bean-style naming, i.e. getLower and getUpper?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, will fix

@pgomulka pgomulka requested a review from pugnascotia December 10, 2019 11:32
---
"Test Index and Search locale dependent mappings / dates":
- skip:
version: " - 6.1.99"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this redundant now?

Copy link
Contributor Author

@pgomulka pgomulka Dec 10, 2019

Choose a reason for hiding this comment

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

so in master I think it is not needed. The - 6.1.99 is translated into 7.0.0 - 6.1.99 And master runs bwc tests from 7.0 - 8 range

boolean skip = lowerVersion != null && upperVersion != null && currentVersion.onOrAfter(lowerVersion)
&& currentVersion.onOrBefore(upperVersion);
boolean skip = versionRanges.stream().anyMatch(range -> range.contains(currentVersion));
skip |= Features.areAllSupported(features) == false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it's worth changing this to the following?

return skip || Features.areAllSupported(features) == false;

lower.isEmpty() ? VersionUtils.getFirstVersion() : Version.fromString(lower),
upper.isEmpty() ? Version.CURRENT : Version.fromString(upper)
};
private static String wrapWithSpaces(String rawRange) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this now?

@pgomulka pgomulka merged commit 90c59a1 into elastic:master Dec 10, 2019
pgomulka added a commit to pgomulka/elasticsearch that referenced this pull request Dec 10, 2019
Multiple version ranges are allowed to be used in section skip in yml
tests. This is useful when a bugfix was backported to latest versions
and all previous releases contain a wire breaking bug.
examples:
6.1.0 - 6.3.0, 6.6.0 - 6.7.9, 7.0 -
- 7.2, 8.0.0 -
pgomulka added a commit that referenced this pull request Dec 10, 2019
Multiple version ranges are allowed to be used in section skip in yml
tests. This is useful when a bugfix was backported to latest versions
and all previous releases contain a wire breaking bug.
examples:
6.1.0 - 6.3.0, 6.6.0 - 6.7.9, 7.0 -
- 7.2, 8.0.0 -
backport #50014
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
Multiple version ranges are allowed to be used in section skip in yml
tests. This is useful when a bugfix was backported to latest versions
and all previous releases contain a wire breaking bug.
examples:
6.1.0 - 6.3.0, 6.6.0 - 6.7.9, 7.0 -
- 7.2, 8.0.0 -
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.6.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants