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

Test rework, part 3 #3464

Merged
merged 4 commits into from
Oct 4, 2024
Merged

Conversation

apostasie
Copy link
Contributor

@apostasie apostasie commented Sep 25, 2024

On top of #3455

Notably:

  • first commit has a raft of evolutions to test tooling in preparation for more test rewrites
  • second commit tentatively addresses flakyness of TestAttach
  • third commit disables parallelism for Docker on prune and rmi tests

@apostasie apostasie changed the title [WIP] Test rework, part 3 Sep 25, 2024
@apostasie apostasie marked this pull request as ready for review September 25, 2024 22:28
@apostasie apostasie marked this pull request as draft September 26, 2024 02:16
@@ -56,54 +56,58 @@ func TestVolumePrune(t *testing.T) {
}

// This set must be marked as private, since we cannot prune without interacting with other tests.
testGroup := &test.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.

This pattern does not work here, as the Group will run in Parallel with other tests, breaking things for Docker.
It works with nerdctl because we are making the subtests pivate - for Docker, the subtests disable parallel, but since the parent stays parallel, it blows up.

Changing to a Test parent instead of a group, and disabling parallel on the subtests.

@apostasie apostasie force-pushed the qa-tooling-fixes branch 2 times, most recently from 28c0e5f to 3811ad6 Compare September 26, 2024 03:35
@apostasie apostasie marked this pull request as ready for review September 26, 2024 17:42
@apostasie
Copy link
Contributor Author

@AkihiroSuda this is ready - to be merged after #3455

@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Sep 27, 2024
@apostasie
Copy link
Contributor Author

@AkihiroSuda let me rebase this so we get a clean view (and might amend something).
#3435 is more important to review either way (if you do have free cycles).

@apostasie
Copy link
Contributor Author

Hitting 429 with Docker Hub :-(

Otherwise, this is now rebased and ready.

@apostasie apostasie marked this pull request as ready for review September 27, 2024 00:57
@AkihiroSuda
Copy link
Member

Needs rebase

@apostasie
Copy link
Contributor Author

Needs rebase

Will wait for #3483 to land as the CI is currently bust.

@apostasie
Copy link
Contributor Author

Rebased (w. CI bustage fix)

@AkihiroSuda AkihiroSuda added the area/ci e.g., CI failure label Oct 2, 2024
@@ -117,16 +116,10 @@ func (dt *data) getConfig() map[ConfigKey]ConfigValue {
}

func defaultIdentifierHashing(name string) string {
Copy link
Member

Choose a reason for hiding this comment

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

Why change?

Copy link
Contributor Author

@apostasie apostasie Oct 2, 2024

Choose a reason for hiding this comment

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

I did hit a case where the message was over 76, which got shortened to a sha256.

Turned out distribution registry rejected it (as an image name), as there is an undocumented limitation rejecting valid image names that are 64-byte hexadecimal strings...

There are also plenty of cases where this fails as an image identifier (with repeat or trailing - or _)

Copy link
Contributor Author

@apostasie apostasie Oct 2, 2024

Choose a reason for hiding this comment

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

I will revert this to a readable form later (the sha1 are hurting readability) - it takes a bit more work though to handle the len limitation while keeping readability and avoiding collisions and keeping in line with id grammar.

@apostasie
Copy link
Contributor Author

Rebased.

CI is green (except the usual windows reg).

@AkihiroSuda
Copy link
Member

Do you plan to revert the hashing func?

#3464 (comment)

@apostasie
Copy link
Contributor Author

Do you plan to revert the hashing func?

#3464 (comment)

Yes - here is the next round version:

func defaultIdentifierHashing(names ...string) string {
// Notes: this identifier MAY be used for namespaces, image names, etc.
// So, the rules are stringent on what it can contain.
replaceWith := []byte("-")
name := strings.ToLower(strings.Join(names, string(replaceWith)))
// Ensure we have a unique identifier despite characters replacements (well, as unique as name)
signature := digest.SHA256.FromString(name).Encoded()[0:8]
// Make sure we do not use any unsafe characters
safeName := regexp.MustCompile(`[^a-zA-Z0-9-]+`)
noRepeat := regexp.MustCompile(fmt.Sprintf(`[%s]{2,}`, replaceWith))
sn := safeName.ReplaceAll([]byte(name), replaceWith)
sn = noRepeat.ReplaceAll(sn, replaceWith)
// Ensure we will never go above 76 characters in length (with signature)
if len(sn) > 67 {
sn = sn[0:67]
}
return string(sn) + "-" + signature
}

This seems to bother you - if you prefer I can just backport it here right away - the thing is, this whole thing (rewrite test+tooling) is so huge that it has to be in incremental steps... I appreciate it does introduce a bit of churn, which is always unfortunate...

As we make progress rewriting tests, the new tooling needs to adapt.
In a shell, this is:
- introducing (more) `Requirements`, with a better API
- update documentation
- fix some t.Helper calls
- fix broken stdin implementation
- do cleanup custom namespaces properly
- change hashing function
- disable "private" implying custom data root which is more trouble than is worth
- minor cleanups

Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
Signed-off-by: apostasie <spam_blackhole@farcloser.world>
@apostasie
Copy link
Contributor Author

apostasie commented Oct 4, 2024

Making things simpler - just backported the new version of the hashing method.

Sorry for the confusion about what was meant by "later" (on this PR vs. an upcoming PR)

Pending CI.

@apostasie
Copy link
Contributor Author

Windows failures are the usual TestRunWithTtyAndDetached aka #3437

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit ccde5bd into containerd:main Oct 4, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci e.g., CI failure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants