From c147d8e9713b6f94e6fcfa7ee08be16bc6b64d0f Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Mon, 21 Oct 2024 16:10:17 -0400 Subject: [PATCH] Do not specify versions during 'melange test' (Revert #1579 and #1518) 1518 was added with good reason, but it changed behavior that many wolfi tests depended on (see #1579) for that use case. Revert both of those changes, restoring behavior to the way it was last week and thus restoring functional test of may wolfi packages. Signed-off-by: Scott Moser --- pkg/build/compile.go | 6 ++---- pkg/build/compile_test.go | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/pkg/build/compile.go b/pkg/build/compile.go index 9a2c6b83f..824fc855b 100644 --- a/pkg/build/compile.go +++ b/pkg/build/compile.go @@ -75,8 +75,7 @@ func (t *Test) Compile(ctx context.Context) error { te := &cfg.Subpackages[i].Test.Environment.Contents // Append the subpackage that we're testing to be installed. - version := fmt.Sprintf("%s-r%d", t.Configuration.Package.Version, t.Configuration.Package.Epoch) - te.Packages = append(te.Packages, sp.Name+"~"+version) + te.Packages = append(te.Packages, sp.Name) if err := test.CompilePipelines(ctx, sm, sp.Test.Pipeline); err != nil { return fmt.Errorf("compiling subpackage %q tests: %w", sp.Name, err) @@ -97,8 +96,7 @@ func (t *Test) Compile(ctx context.Context) error { if t.Package != "" { te.Packages = append(te.Packages, t.Package) } else { - version := fmt.Sprintf("%s-r%d", t.Configuration.Package.Version, t.Configuration.Package.Epoch) - te.Packages = append(te.Packages, t.Configuration.Package.Name+"~"+version) + te.Packages = append(te.Packages, t.Configuration.Package.Name) } if err := test.CompilePipelines(ctx, sm, cfg.Test.Pipeline); err != nil { diff --git a/pkg/build/compile_test.go b/pkg/build/compile_test.go index 08dd0cb65..336b1075a 100644 --- a/pkg/build/compile_test.go +++ b/pkg/build/compile_test.go @@ -71,12 +71,8 @@ func TestInheritWorkdir(t *testing.T) { func TestCompileTest(t *testing.T) { test := &Test{ + Package: "main", Configuration: config.Configuration{ - Package: config.Package{ - Name: "main", - Version: "1.2.3", - Epoch: 4, - }, Test: &config.Test{ Environment: apko_types.ImageConfiguration{ Contents: apko_types.ImageContents{ @@ -111,11 +107,11 @@ func TestCompileTest(t *testing.T) { t.Fatalf("unexpected error: %v", err) } - if got, want := test.Configuration.Test.Environment.Contents.Packages, []string{"main-base", "main~1.2.3-r4", "main-need"}; !slices.Equal(got, want) { + if got, want := test.Configuration.Test.Environment.Contents.Packages, []string{"main-base", "main", "main-need"}; !slices.Equal(got, want) { t.Errorf("main test packages: want %v, got %v", want, got) } - if got, want := test.Configuration.Subpackages[0].Test.Environment.Contents.Packages, []string{"subpackage-base", "subpackage~1.2.3-r4", "subpackage-need"}; !slices.Equal(got, want) { + if got, want := test.Configuration.Subpackages[0].Test.Environment.Contents.Packages, []string{"subpackage-base", "subpackage", "subpackage-need"}; !slices.Equal(got, want) { t.Errorf("subpackage test packages: want %v, got %v", want, got) } }