Fold the retake integration test into the failed-key test as a subtest, so the integration count stays (issue 1748)
Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
@@ -495,47 +495,47 @@ func TestAnArchiveOnlyModuleAndARootModuleAreBuilt(t *testing.T) {
|
||||
// failed naming it; the indexer writing modules.<m> again with the same fingerprint wakes the builder, which builds
|
||||
// the key again as a new revision of the same key, now done.
|
||||
func TestAFailedKeyIsBuiltAgainAsANewRevisionFromANewModulesValueWithTheSameFingerprint(t *testing.T) { // 1607/AC6, AC7
|
||||
b := startBed(t)
|
||||
b.fake.failBuild.Store(true)
|
||||
b.archive(t, "ca-trust", "modules/ca-trust", commit)
|
||||
b.start(t, "n1", nil)
|
||||
v := b.await(t, "ca-trust", isState(delivery.BuildFailed))
|
||||
if !strings.Contains(v.Error, " on n") || !strings.Contains(v.Error, "boom") {
|
||||
t.Errorf("build = %+v, want failed naming the node and the step's reason", v)
|
||||
}
|
||||
key, _ := delivery.BuilderBuildKey("ca-trust", fp)
|
||||
failed, err := b.builds.Get(b.ctx, key)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b.fake.failBuild.Store(false)
|
||||
// The indexer writes the module again (here at a later commit), with the same fingerprint.
|
||||
b.archive(t, "ca-trust", "modules/ca-trust", "89abcdef0123456789abcdef0123456789abcdef")
|
||||
b.await(t, "ca-trust", isState(delivery.BuildDone))
|
||||
done, err := b.builds.Get(b.ctx, key)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if done.Revision() <= failed.Revision() {
|
||||
t.Errorf("revision %d, was %d: the key was not written as a new revision", done.Revision(), failed.Revision())
|
||||
}
|
||||
}
|
||||
|
||||
// 1748/AC6: a build failed retakeable is built again after its backoff, with no new modules value or other event, and ends
|
||||
// done; the key says it was retaken once.
|
||||
func TestARetakeableFailureIsBuiltAgainAfterItsBackoffAndEndsDone(t *testing.T) {
|
||||
b := startBed(t)
|
||||
b.fake.failRetakeable.Store(true)
|
||||
b.archive(t, "ca-trust", "modules/ca-trust", commit)
|
||||
b.start(t, "n1", map[string]string{"MESH_BUILDER_RETAKE_BACKOFF": "300ms"})
|
||||
if v := b.await(t, "ca-trust", func(v delivery.BuilderBuild) bool { return v.State == delivery.BuildFailed }); !delivery.Retakeable(v.Error) {
|
||||
t.Fatalf("build = %+v, want failed retakeable", v)
|
||||
}
|
||||
b.fake.failRetakeable.Store(false) // the lookup passes
|
||||
v := b.await(t, "ca-trust", isState(delivery.BuildDone))
|
||||
if v.Retakes < 1 {
|
||||
t.Errorf("done key = %+v, want its retake counted", v)
|
||||
}
|
||||
t.Run("a new modules value with the same fingerprint", func(t *testing.T) {
|
||||
b := startBed(t)
|
||||
b.fake.failBuild.Store(true)
|
||||
b.archive(t, "ca-trust", "modules/ca-trust", commit)
|
||||
b.start(t, "n1", nil)
|
||||
v := b.await(t, "ca-trust", isState(delivery.BuildFailed))
|
||||
if !strings.Contains(v.Error, " on n") || !strings.Contains(v.Error, "boom") {
|
||||
t.Errorf("build = %+v, want failed naming the node and the step's reason", v)
|
||||
}
|
||||
key, _ := delivery.BuilderBuildKey("ca-trust", fp)
|
||||
failed, err := b.builds.Get(b.ctx, key)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b.fake.failBuild.Store(false)
|
||||
// The indexer writes the module again (here at a later commit), with the same fingerprint.
|
||||
b.archive(t, "ca-trust", "modules/ca-trust", "89abcdef0123456789abcdef0123456789abcdef")
|
||||
b.await(t, "ca-trust", isState(delivery.BuildDone))
|
||||
done, err := b.builds.Get(b.ctx, key)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if done.Revision() <= failed.Revision() {
|
||||
t.Errorf("revision %d, was %d: the key was not written as a new revision", done.Revision(), failed.Revision())
|
||||
}
|
||||
})
|
||||
// 1748/AC6: a build failed retakeable is built again after its backoff, with no new modules value or other event, and
|
||||
// ends done; the key says it was retaken.
|
||||
t.Run("a retakeable failure after its backoff", func(t *testing.T) {
|
||||
b := startBed(t)
|
||||
b.fake.failRetakeable.Store(true)
|
||||
b.archive(t, "ca-trust", "modules/ca-trust", commit)
|
||||
b.start(t, "n1", map[string]string{"MESH_BUILDER_RETAKE_BACKOFF": "300ms"})
|
||||
if v := b.await(t, "ca-trust", isState(delivery.BuildFailed)); !delivery.Retakeable(v.Error) {
|
||||
t.Fatalf("build = %+v, want failed retakeable", v)
|
||||
}
|
||||
b.fake.failRetakeable.Store(false) // the lookup passes
|
||||
if v := b.await(t, "ca-trust", isState(delivery.BuildDone)); v.Retakes < 1 {
|
||||
t.Errorf("done key = %+v, want its retake counted", v)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// TestAToolchainChangeDoesNotBuildTheOldFingerprint: the fingerprint names go1.27.1, the nodes then agree on go1.27.2 (a
|
||||
|
||||
Reference in New Issue
Block a user