-
-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: prepend substitutors for built images (#2577)
- Loading branch information
1 parent
467a3fb
commit 9cf5e9f
Showing
3 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package testcontainers | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/testcontainers/testcontainers-go/image" | ||
) | ||
|
||
func TestSubstituteBuiltImage(t *testing.T) { | ||
req := Request{ | ||
FromDockerfile: FromDockerfile{ | ||
Context: "testdata", | ||
Dockerfile: "echo.Dockerfile", | ||
Tag: "my-image", | ||
Repo: "my-repo", | ||
}, | ||
ImageSubstitutors: []image.Substitutor{image.NewPrependHubRegistry("my-registry")}, | ||
Started: false, | ||
} | ||
|
||
t.Run("should not use the properties prefix on built images", func(t *testing.T) { | ||
c, err := New(context.Background(), req) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
json, err := c.Inspect(context.Background()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if json.Config.Image != "my-registry/my-repo:my-image" { | ||
t.Errorf("expected my-registry/my-repo:my-image, got %s", json.Config.Image) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters