Skip to content

update some fixtures in tests#50640

Merged
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:update_tests
Aug 6, 2025
Merged

update some fixtures in tests#50640
thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah:update_tests

Conversation

@thaJeztah
Copy link
Member

updated TestModuleVersion fixture (looks like the test doesn't really care :D)

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 29.0.0 milestone Aug 5, 2025
@thaJeztah thaJeztah added status/2-code-review area/testing kind/refactor PR's that refactor, or clean-up code labels Aug 5, 2025
updated TestModuleVersion fixture (looks like the test doesn't really care :D)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Member Author

thaJeztah commented Aug 5, 2025

Test failure was unrelated, but the output of this test makes me wonder if there's something iffy with code parsing output (see the stray comma at the start of one line, which could be that we split a string in the wrong way?)

=== FAIL: amd64.integration-cli TestDockerSwarmSuite/TestAPISwarmServicesMultipleAgents (51.36s)
    docker_api_swarm_service_test.go:103: [db0bb4eab7baa] joining swarm manager [d5c5beb3314ab]@0.0.0.0:2477, swarm listen addr 0.0.0.0:2478
    docker_api_swarm_service_test.go:104: [deed8a71e9aed] joining swarm manager [d5c5beb3314ab]@0.0.0.0:2477, swarm listen addr 0.0.0.0:2479
    docker_api_swarm_service_test.go:125: timeout hit after 30s: 7eca8fb27fe1
        f9ad8344bb58
        a75931b4495f
        , f95f8aa19a3d
        202d504c6c4f
        f1f4233b5777
        ff387d8ca07d
        d99664f60a5b

Failure is produced here;

instances = 5
d1.UpdateService(ctx, c, d1.GetService(ctx, c, id), setInstances(instances))
poll.WaitOn(c, pollCheck(c, reducedCheck(sumAsIntegers, d1.CheckActiveContainerCount(ctx), d3.CheckActiveContainerCount(ctx)), checker.Equals(instances)), poll.WithTimeout(defaultReconciliationTimeout))

But the CheckActiveContainerCount utility looks like where that list is constructed; definitely wouldn't surprise me if it ends up with malformed strings or something from the output;

// CheckActiveContainerCount returns the number of active containers
// FIXME(vdemeester) should re-use ActivateContainers in some way
func (d *Daemon) CheckActiveContainerCount(ctx context.Context) func(t *testing.T) (interface{}, string) {
return func(t *testing.T) (interface{}, string) {
t.Helper()
apiClient, err := client.NewClientWithOpts(client.FromEnv, client.WithHost(d.Sock()))
assert.NilError(t, err)
ctrs, err := apiClient.ContainerList(ctx, container.ListOptions{})
_ = apiClient.Close()
assert.NilError(t, err)
var out strings.Builder
for _, ctr := range ctrs {
out.WriteString(stringid.TruncateID(ctr.ID) + "\n")
}
return len(ctrs), out.String()
}
}

@thaJeztah
Copy link
Member Author

Oh, actually CheckActiveContainerCount uses the API and the c.ID, so unlikely to be wrong, but this part looks more likely; here we're string-joining things (possibly empty?)

func reducedCheck(r reducer, funcs ...checkF) checkF {
return func(t *testing.T) (interface{}, string) {
t.Helper()
var values []interface{}
var comments []string
for _, f := range funcs {
v, comment := f(t)
values = append(values, v)
if comment != "" {
comments = append(comments, comment)
}
}
return r(values...), fmt.Sprintf("%v", strings.Join(comments, ", "))
}
}

@thaJeztah thaJeztah marked this pull request as ready for review August 6, 2025 06:27
@thaJeztah thaJeztah merged commit 18940b6 into moby:master Aug 6, 2025
247 of 248 checks passed
@thaJeztah thaJeztah deleted the update_tests branch August 6, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants