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

Tests: Improve size regex in documentation test #26879

Merged
merged 5 commits into from
Nov 13, 2017

Conversation

spinscale
Copy link
Contributor

The regex has been changed to not only be able to deal with something
like 260b, but also support 1.1kb.

This little stems from a test failure in 6.x, which can be seen here https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.x+multijob-unix-compatibility/os=amazon/203/consoleText

I am not a hundred percent sure, if there should be more investigations regarding that increased index size, but I would assume that this is not the culprit.

The regex has been changed to not only be able to deal with something
like `260b`, but also support `1.1kb`.
@spinscale spinscale added review >test Issues or PRs that are addressing/adding tests labels Oct 4, 2017
Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

@spinscale the change in the regex looks good to me, however I'm also curious how this tripped since I cannot reproduce the failure locally (tried on 6x since thats where the CI error occured). Do you know if this happen more often recently in tests? If not, might be worth to hold to see what causes it?

@cbuescher
Copy link
Member

Okay, I see failures like this across all branches (6.0, 6x, master) since Sep 15th, not very common but probably still worth fixing.

@cbuescher
Copy link
Member

@spinscale just fyi, I was curious and started adding empty indices to a local cluster running off the 6.x branch, then doing a GET _cat/indices to check their size. They mostly start with an initial store.size of 446b but then after a few seconds go up to the 1.1kb that we occasionally see in the tests. I guess its only a timing issue in the tests, so good to cover all cases.

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

Will this match 1.1kb? I think it doesn't take the k.

@@ -352,7 +352,7 @@ And the response:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open customer 95SQ4TSUT7mWBT7VNHH67A 5 1 0 0 260b 260b
--------------------------------------------------
// TESTRESPONSE[s/95SQ4TSUT7mWBT7VNHH67A/.+/ s/260b/\\d+b/ _cat]
// TESTRESPONSE[s/95SQ4TSUT7mWBT7VNHH67A/.+/ s/260b/\\d+(\\.\\d+)?b/ _cat]
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we also cover the case where the unit changes from b to kb ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

does \d+(\.\d)?[kbg]?b sound better? With that 1.1b, 100b, 12.1gb, 1.1kb should match

Copy link
Member

Choose a reason for hiding this comment

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

I think restricting it to kb and b only for this test would be better, we should detect if the value suddenly jumps to mb here for an almost empty index. So adding k? to the mix should be enough IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

@cbuescher ++ that's what I had in mind too.

@@ -368,7 +368,7 @@ And the response:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open customer 95SQ4TSUT7mWBT7VNHH67A 5 1 0 0 260b 260b
--------------------------------------------------
// TESTRESPONSE[s/95SQ4TSUT7mWBT7VNHH67A/.+/ s/260b/\\d+b/ _cat]
// TESTRESPONSE[s/95SQ4TSUT7mWBT7VNHH67A/.+/ s/260b/\\d+(\\.\\d)?k?b/ _cat]
Copy link
Member

@cbuescher cbuescher Nov 8, 2017

Choose a reason for hiding this comment

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

Ah, damn regex! This looks like its going to work for sth. like 1234b and 1.1kb but will not match if we get two or more digits after the comma at some point. At least according to http://www.regexplanet.com/advanced/java/index.html, \\d+(\\.\\d)?k?b doesn't match e.g. 1.123kb. I think \\d+\\.?\\d+?k?b might, and I don't think we need the group?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed, the grouping can be removed. No need to support .123, because the formatting is cut after one decimal by the ByteSizeValue class

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

LGTM

@spinscale spinscale merged commit 08037ee into elastic:master Nov 13, 2017
spinscale added a commit that referenced this pull request Nov 13, 2017
The regex has been changed to not only be able to deal with something
like `260b`, but also support `1.1kb`.
spinscale added a commit that referenced this pull request Nov 13, 2017
The regex has been changed to not only be able to deal with something
like `260b`, but also support `1.1kb`.
martijnvg added a commit that referenced this pull request Nov 14, 2017
* es/master: (24 commits)
  Reduce synchronization on field data cache
  add json-processor support for non-map json types (#27335)
  Properly format IndexGraveyard deletion date as date (#27362)
  Upgrade AWS SDK Jackson Databind to 2.6.7.1
  Stop responding to ping requests before master abdication (#27329)
  [Test] Fix POI version in packaging tests
  Allow affix settings to specify dependencies (#27161)
  Tests: Improve size regex in documentation test (#26879)
  reword comment
  Remove unnecessary logger creation for doc values field data
  [Geo] Decouple geojson parse logic from ShapeBuilders
  [DOCS] Fixed link to docker content
  Plugins: Add versionless alias to all security policy codebase properties (#26756)
  [Test] #27342 Fix SearchRequests#testValidate
  [DOCS] Move X-Pack-specific Docker content (#27333)
  Fail queries with scroll that explicitely set request_cache (#27342)
  [Test] Fix S3BlobStoreContainerTests.testNumberOfMultiparts()
  Set minimum_master_nodes to all nodes for REST tests (#27344)
  [Tests] Relax allowed delta in extended_stats aggregation (#27171)
  Remove S3 output stream (#27280)
  ...
martijnvg added a commit that referenced this pull request Nov 14, 2017
* 6.x: (27 commits)
  Reduce synchronization on field data cache
  [Test] #27342 Fix SearchRequests#testValidate
  Fail queries with scroll that explicitely set request_cache (#27342)
  add json-processor support for non-map json types (#27335)
  Upgrade AWS SDK Jackson Databind to 2.6.7.1
  Properly format IndexGraveyard deletion date as date (#27362)
  Stop responding to ping requests before master abdication (#27329)
  [Test] Fix POI version in packaging tests
  Added release notes for 6.0.0
  Update 6.0.0-beta1.asciidoc
  Allow affix settings to specify dependencies (#27161)
  Tests: Improve size regex in documentation test (#26879)
  reword comment
  Ensure external refreshes will also refresh internal searcher to minimize segment creation (#27253)
  Remove unnecessary logger creation for doc values field data
  [DOCS] Fixed link to docker content
  Plugins: Add versionless alias to all security policy codebase properties (#26756)
  [DOCS] Move X-Pack-specific Docker content (#27333)
  [Test] Fix S3BlobStoreContainerTests.testNumberOfMultiparts()
  Set minimum_master_nodes to all nodes for REST tests (#27344)
  ...
@lcawl lcawl removed the v6.1.0 label Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>test Issues or PRs that are addressing/adding tests v6.0.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants