-
Notifications
You must be signed in to change notification settings - Fork 1
chore: executor: DoCacheProbe: remove fake verbiage #15
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
Conversation
@@ -37,8 +41,7 @@ func TestDoCacheProbe(t *testing.T) { | |||
COPY foo/bar.txt copied/ | |||
` | |||
os.WriteFile(filepath.Join(testDir, "workspace", "Dockerfile"), []byte(dockerFile), 0755) | |||
// Populate the cache by doing an initial build | |||
cacheDir := t.TempDir() | |||
regCache := setupCacheRegistry(t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review: I noticed the oci:/
repo was not actually pushing to cacheDir
so I elected to stand up a temporary registry instad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
t.Run("MultiStage", func(t *testing.T) { | ||
t.Skip("TODO: https://github.com/coder/envbuilder/issues/230") | ||
testDir, fn := setupMultistageTests(t) | ||
defer fn() | ||
dockerFile := ` | ||
FROM scratch as first | ||
COPY foo/bam.txt copied/ | ||
ENV test test | ||
|
||
From scratch as second | ||
COPY --from=first copied/bam.txt output/bam.txt` | ||
os.WriteFile(filepath.Join(testDir, "workspace", "Dockerfile"), []byte(dockerFile), 0755) | ||
regCache := setupCacheRegistry(t) | ||
opts := &config.KanikoOptions{ | ||
DockerfilePath: filepath.Join(testDir, "workspace", "Dockerfile"), | ||
SrcContext: filepath.Join(testDir, "workspace"), | ||
SnapshotMode: constants.SnapshotModeRedo, | ||
Cache: true, | ||
CacheOptions: config.CacheOptions{ | ||
CacheTTL: time.Hour, | ||
}, | ||
CacheCopyLayers: true, | ||
CacheRunLayers: true, | ||
CacheRepo: regCache + "/test", | ||
} | ||
_, err := DoBuild(opts) | ||
testutil.CheckNoError(t, err) | ||
os.WriteFile(filepath.Join(testDir, "workspace", "Dockerfile"), []byte(dockerFile), 0755) | ||
opts.Reproducible = true | ||
_, err = DoCacheProbe(opts) | ||
testutil.CheckNoError(t, err) | ||
// Check Image has one layer bam.txt | ||
files, err := readDirectory(filepath.Join(testDir, "output")) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
testutil.CheckDeepEqual(t, 1, len(files)) | ||
testutil.CheckDeepEqual(t, files[0].Name(), "bam.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this germane to this set of changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's just a drive-by. I figured I may as well add the test for later since I had it hanging around unstaged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post-merge approval 👍
FakeExecuteCommand
toCachedExecuteCommand