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

allow more customisation in cardinality, fuzziness and range #46

Merged
merged 4 commits into from
Jan 26, 2023

Conversation

aspacca
Copy link
Contributor

@aspacca aspacca commented Jan 25, 2023

No description provided.

@aspacca aspacca requested a review from endorama January 25, 2023 05:20
@aspacca aspacca self-assigned this Jan 25, 2023
@elasticmachine
Copy link

elasticmachine commented Jan 25, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-01-25T11:16:10.975+0000

  • Duration: 3 min 44 sec

Test stats 🧪

Test Results
Failed 0
Passed 65
Skipped 0
Total 65

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Member

@endorama endorama left a comment

Choose a reason for hiding this comment

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

Small typo and a question. Overall 👍

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Comment on lines +234 to +235
rangeMin := rand.Intn(100)
rangeMax := rand.Intn(10000-rangeMin) + rangeMin
Copy link
Member

Choose a reason for hiding this comment

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

What's the benefit of using random values here?

Copy link
Contributor Author

@aspacca aspacca Jan 25, 2023

Choose a reason for hiding this comment

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

as you know, I prefer to have some fuzziness in tests, to catch potential hidden bugs ;)

the benefit is not from the randomness itself, but for the fact that every cardinality is tested with a different range: the intent is to test that cardinality correctness is not bound to a specific range. we can also have a fixed list of ranges for every cardinality

Copy link
Member

@endorama endorama Jan 25, 2023

Choose a reason for hiding this comment

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

I'm not sure this test is actually behaving like that. Without updating the seed the generated values will not change. (Seed docs, it behaves like always using Seed(1))

See for a playground: https://go.dev/play/p/xZNnm-YMp6I

From my understanding without updating the seed (I'm not sure if this happens somewhere, but searching for Seed or rand.Seed in this repo given 0 results) this code behave like using a constant value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my understanding without updating the seed (I'm not sure if this happens somewhere, but searching for Seed or rand.Seed in this repo given 0 results) this code behave like using a constant value.

yes, I don't update the seed, indeed. but that's not needed: every call to rand.Intn does not generate a constant value, rather, multiple calls with the same seed generate always the same sequence:

Seed values that have the same remainder when divided by 2³¹-1 generate the same pseudo-random sequence

I suppose that once the sequence is completely generated it will start over. I have to look how long is the sequence (int64 size?) but we are far from filling it :)

so basically we test always with the same sequence, indeed, that's why I mentioned that "we can also have a fixed list of ranges for every cardinality" :)

or we can use the current unix timestamp as seed, reducing the number of identical sequences between each tests run

@@ -159,22 +161,40 @@ And the following config file content:
- name: AccountID
value: 123456789012
- name: InterfaceID
cardinality: 10
cardinality:
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 it may make sense to have a assets/templates/example folder where we put these example as they make the Readme harder to read. What do you think?

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, I would add in a separate PR. what about yours for docs?

Copy link
Member

Choose a reason for hiding this comment

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

ok on doing in a separate PR. I will rebase my doc and update it once this is merged

aspacca and others added 2 commits January 25, 2023 12:15
Co-authored-by: Edoardo Tenani <[email protected]>
Co-authored-by: Edoardo Tenani <[email protected]>
@aspacca aspacca merged commit f42e909 into elastic:main Jan 26, 2023
endorama added a commit to endorama/elastic-integration-corpus-generator-tool that referenced this pull request Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants