Skip to content

test: fix variants of `TestAPIConformance/manifest_Put_Schema2_MissingConfigAndLayers` flake

Pawel Rozlach requested to merge prozlach/921_flake_fix into master

What does this MR do?

Resolves #921 (closed)

The source of the flakiness were to small sizes of the layers generated by createRandomSmallLayer() function. This was causing collisions.

Depending on the layer size randomly chosen by the function, we were getting different likelihood for collision with layer size 0 being most likely. The test was pushing sample layer first and then it was generating two more layers that it was assuming will not be there in the repo, but in case of the collision, their sha was identical to the layer that was pushed just before and this way we were getting "not enough" missing layers error.

For example, the two flakes where we had good enough logging:

In both cases we can see two shas:

  • 41538a8cd30a872df1ce8bf9a9e96f0231a3e926277cd51087adcf1c813fb7be - sha of the configuration blob
  • e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - sha of the 0-sized layer(!).

I have verified the behaviour using this simple program.

sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855: 500512
Slice sizes 0,
sha256:4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a: 2053
Slice sizes 1,
sha256:7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451: 2040
Slice sizes 1,
sha256:de5a6f78116eca62d7fc5ce159d23ae6b889b365a1739ad2cf36f925a140d0cc: 2039
Slice sizes 1,
sha256:04d6c0c946716aac894fc1653383543a91faab601302cf011607c82f06304651: 2038
Slice sizes 1,
sha256:83891d7fe85c33e52c8b4e5814c92fb6a3b9467299200538a6babaa8b452d879: 2037
Slice sizes 1,
sha256:3cbdaf66b3dd2b174788a2f17f938b52dda93a2a97440cead19332cbfacba7c8: 2037
Slice sizes 1,
sha256:8a8950f7623663222542c9469c73be3c4c81bbdf019e2c577590a61f2ce9a157: 2036
Slice sizes 1,
sha256:380918b946a526640a40df5dced6516794f3d97bbd9e6bb553d037c4439f31c3: 2033
Slice sizes 1,
sha256:1f184f101c67d585ba00d24cfde36863f747fbab9e84af7760ec771e9b36ca51: 2033
Slice sizes 1,
sha256:8a331fdde7032f33a71e1b2e257d80166e348e00fcb17914f48bdb57a1c63007: 2032
Slice sizes 1,
sha256:0a43b22d89fa2499be5c7704c9bf273260b0ca9588e4cd1897cd80f9c96cd97a: 2030
Slice sizes 1,
sha256:d4f09e5c5af99a24c7e304ca7997d26cb00901697de08a49be0d46ab5839b614: 2029
Slice sizes 1,
sha256:30a5bfa58e128af9e5a4955725d8ad26d4d574a537b58b7dc6d357acad578572: 2028
Slice sizes 1,
sha256:d1bbd73bb09190bfb883056771e22e997541ed20079793bf33975fe1654581c3: 2027
Slice sizes 1,
sha256:27abdeddfe8503496adeb623466caa47da5f63abd2bc6fa19f6cfcb73ecfed70: 2026
Slice sizes 1,
sha256:3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d: 2024
Slice sizes 1,
sha256:df7e70e5021544f4834bbee64a9e3789febc4be81470df629cad6ddb03320a5c: 2024
Slice sizes 1,
sha256:de7d1b721a1e0632b7cf04edf5032c8ecffa9f9a08492152b926f1a5a7e765d7: 2021
Slice sizes 1,
sha256:7da59d0dfbe21f43e842e8afb43e12a6445bbac07c2fc26984c71d0de3f99c9c: 2021
Slice sizes 1,
sha256:f4f97c88c409dcf3789b5b518da3f7d266c488066e97a606e38a150779880735: 2019
Slice sizes 1,
sha256:cbe5cfdf7c2118a9c3d78ef1d684f3afa089201352886449a06a6511cfef74a7: 2016
Slice sizes 1,
sha256:8d36bbb3d6fbf24f38ba020d9ceeef5d4562f5f26629f66b076ff395c438695e: 2015
Slice sizes 1,
sha256:956062137518b270d730d4753000896de17c100a42f9e24f5acee2faa75d5fdd: 2015
Slice sizes 1,
sha256:3973e022e93220f9212c18d0d0c543ae7c309e46640da93a4a0314de999f5112: 2013
Slice sizes 1,
sha256:27952171c7fcdf0ddc765ab4f4e1c537cb29e5e533d57b3456257ee785c81711: 2013
Slice sizes 1,
sha256:3ebe1b59762a1c8020c1efe3747dd07f0e30617ed60b4e6a5bee16b6ea421dd0: 2013
Slice sizes 1,
sha256:2d711642b726b04401627ca9fbac32f5c8530fb1903cc4db02258717921a4881: 2012
Slice sizes 1,
sha256:67c872d4912c71f15d2d6134ddf1d33d46f4bab2b56fe787522e7e4c9b58657d: 2007
Slice sizes 1,
sha256:d1211001882d2ce16a8553e449b6c8b7f71e61836efc2e416143808f20e721e7: 2006
Slice sizes 1,
sha256:591b7cc95037822dec5a4d593a2e2e8b19c07ddd2570e5699003d17f14c440a6: 2005
Slice sizes 1,
sha256:265fda17a34611b1533d8a281ff680dc5791b0ce0a11c25b35e11c8e75685509: 2005
Slice sizes 1,
sha256:72dfcfb0c470ac255cde83fb8fe38de8a128188e03ea5ba5b2a93adbea1062fa: 2003
Slice sizes 1,
sha256:cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8: 1999
Slice sizes 1,
sha256:e3b98a4da31a127d4bde6e43033f66ba274cab0eb7eb1c70ec41402bf6273dd8: 1997
Slice sizes 1,
sha256:35af2d15ebde4d67b29569ec19749e813c76f02286afc5a2a9871c2bfbdaab32: 1996

Once I have bumped the size of the layer to 128-196 range, I can no longer reproduce the collisions.

I have piggy-backed to this MR a small fix to the test I noticed while debugging this issue.

Author checklist

  • Assign one of conventiona-commit prefixes to the MR.
    • fix: Indicates a bug fix, triggers a patch release.
    • feat: Signals the introduction of a new feature, triggers a minor release.
    • perf: Focuses on performance improvements that don't introduce new features or fix bugs, triggers a patch release.
    • docs: Updates or changes to documentation. Does not trigger a release.
    • style: Changes that do not affect the code's functionality. Does not trigger a release.
    • refactor: Modifications to the code that do not fix bugs or add features but improve code structure or readability. Does not trigger a release.
    • test: Changes related to adding or modifying tests. Does not trigger a release.
    • chore: Routine tasks that don't affect the application, such as updating build processes, package manager configs, etc. Does not trigger a release.
    • build: Changes that affect the build system or external dependencies. May trigger a release.
    • ci: Modifications to continuous integration configuration files and scripts. Does not trigger a release.
    • revert: Reverts a previous commit. It could result in a patch, minor, or major release.
  • Feature flags
    • This change does not require a feature flag
    • Added feature flag: ( Add the Feature flag tracking issue link here )
  • Unit-tests
    • Unit-tests are not required
    • I added unit tests
  • Documentation:
  • database changes including schema migrations:
    • Change does not introduce database changes
    • MR includes DB chagnes
      • Do not include code that depends on the schema migrations in the same commit. Split the MR into two or more.
      • Manually run up and down migrations in a postgres.ai production database clone and post a screenshot of the result here.
      • If adding new queries, extract a query plan from postgres.ai and post the link here. If changing existing queries, also extract a query plan for the current version for comparison.
        • I do not have access to postgres.ai and have made a comment on this MR asking for these to be run on my behalf.
  • Ensured this change is safe to deploy to individual stages in the same environment (cny -> prod). State-related changes can be troublesome due to having parts of the fleet processing (possibly related) requests in different ways.
  • If the change contains a breaking change, apply the breaking change label.
  • If the change is considered high risk, apply the label high-risk-change
  • Changes cannot be rolled back
    • Change can be safelly rolled back
    • Change can't be safelly rolled back
      • Apply the label cannot-rollback.
      • Add a section to the MR description that includes the following details:
        • The reasoning behind why a release containing the presented MR can not be rolled back (e.g. schema migrations or changes to the FS structure)
        • Detailed steps to revert/disable a feature introduced by the same change where a migration cannot be rolled back. (note: ideally MRs containing schema migrations should not contain feature changes.)
        • Ensure this MR does not add code that depends on these changes that cannot be rolled back.
Documentation/resources

Code review guidelines

Go Style guidelines

Reviewer checklist

  • Ensure the commit and MR tittle are still accurate.
  • If the change contains a breaking change, verify the breaking change label.
  • If the change is considered high risk, verify the label high-risk-change
  • Identify if the change can be rolled back safely. (note: all other reasons for not being able to rollback will be sufficiently captured by major version changes).
Edited by Pawel Rozlach

Merge request reports

Loading