@@ -57,9 +57,10 @@ import (
57
57
)
58
58
59
59
const (
60
- testContainerLabel = "envbox-integration-test"
61
- testImageAlpine = "localhost:5000/envbuilder-test-alpine:latest"
62
- testImageUbuntu = "localhost:5000/envbuilder-test-ubuntu:latest"
60
+ testContainerLabel = "envbox-integration-test"
61
+ testImageAlpine = "localhost:5000/envbuilder-test-alpine:latest"
62
+ testImageUbuntu = "localhost:5000/envbuilder-test-ubuntu:latest"
63
+ testImageBlobUnknown = "localhost:5000/envbuilder-test-blob-unknown:latest"
63
64
64
65
// nolint:gosec // Throw-away key for testing. DO NOT REUSE.
65
66
testSSHKey = `-----BEGIN OPENSSH PRIVATE KEY-----
@@ -2354,6 +2355,38 @@ USER devalot
2354
2355
}
2355
2356
require .Fail (t , "expected pid 1 to be running as devalot" )
2356
2357
})
2358
+
2359
+ t .Run ("PushDuplicateLayersNoBlobUnknown" , func (t * testing.T ) {
2360
+ t .Parallel ()
2361
+
2362
+ srv := gittest .CreateGitServer (t , gittest.Options {
2363
+ Files : map [string ]string {
2364
+ ".devcontainer/Dockerfile" : fmt .Sprintf (`FROM %s
2365
+ USER root
2366
+ RUN echo "hi i r empty"
2367
+ RUN echo "who u"
2368
+ ` , testImageBlobUnknown ),
2369
+ ".devcontainer/devcontainer.json" : `{
2370
+ "name": "Test",
2371
+ "build": {
2372
+ "dockerfile": "Dockerfile"
2373
+ },
2374
+ }` ,
2375
+ },
2376
+ })
2377
+
2378
+ // NOTE(mafredri): The in-memory registry doesn't catch this error so we
2379
+ // have to use registry:2.
2380
+ ref , err := name .ParseReference (fmt .Sprintf ("localhost:5000/test-blob-unknown-%s" , uuid .NewString ()))
2381
+ require .NoError (t , err )
2382
+ opts := []string {
2383
+ envbuilderEnv ("GIT_URL" , srv .URL ),
2384
+ envbuilderEnv ("CACHE_REPO" , ref .String ()),
2385
+ envbuilderEnv ("VERBOSE" , "1" ),
2386
+ }
2387
+
2388
+ _ = pushImage (t , ref , nil , opts ... )
2389
+ })
2357
2390
}
2358
2391
2359
2392
func TestChownHomedir (t * testing.T ) {
@@ -2532,6 +2565,8 @@ func getCachedImage(ctx context.Context, t *testing.T, cli *client.Client, env .
2532
2565
}
2533
2566
2534
2567
func startContainerFromRef (ctx context.Context , t * testing.T , cli * client.Client , ref name.Reference ) container.CreateResponse {
2568
+ t .Helper ()
2569
+
2535
2570
// Ensure that we can pull the image.
2536
2571
rc , err := cli .ImagePull (ctx , ref .String (), image.PullOptions {})
2537
2572
require .NoError (t , err )
0 commit comments