@@ -1684,8 +1684,8 @@ RUN date --utc > /root/date.txt`, testImageAlpine),
1684
1684
_ , err = runEnvbuilder (t , runOpts {env : append (opts ,
1685
1685
envbuilderEnv ("PUSH_IMAGE" , "1" ),
1686
1686
)})
1687
- // Then: it should fail with an Unauthorized error
1688
- require .ErrorContains (t , err , "401 Unauthorized" , "expected unauthorized error using no auth when cache repo requires it" )
1687
+ // Then: it should succeed but not push the image
1688
+ require .NoError (t , err )
1689
1689
1690
1690
// Then: the image should not be pushed
1691
1691
_ , err = remote .Image (ref , remoteAuthOpt )
@@ -1901,14 +1901,22 @@ RUN date --utc > /root/date.txt`, testImageAlpine),
1901
1901
notRegURL := strings .TrimPrefix (notRegSrv .URL , "http://" ) + "/test"
1902
1902
1903
1903
// When: we run envbuilder with PUSH_IMAGE set
1904
- _ , err := runEnvbuilder (t , runOpts {env : []string {
1904
+ ctrID , err := runEnvbuilder (t , runOpts {env : []string {
1905
1905
envbuilderEnv ("GIT_URL" , srv .URL ),
1906
1906
envbuilderEnv ("CACHE_REPO" , notRegURL ),
1907
1907
envbuilderEnv ("PUSH_IMAGE" , "1" ),
1908
+ envbuilderEnv ("INIT_SCRIPT" , "exit \\ ${ENVBUILDER_EXIT_CODE:-254}" ),
1908
1909
}})
1910
+ require .NoError (t , err )
1909
1911
1910
- // Then: envbuilder should fail with a descriptive error
1911
- require .ErrorContains (t , err , "failed to push to destination" )
1912
+ // Then: envbuilder should fail with a descriptive status code.
1913
+ client , err := client .NewClientWithOpts (client .FromEnv , client .WithAPIVersionNegotiation ())
1914
+ require .NoError (t , err )
1915
+ defer client .Close ()
1916
+ // Get the container exit status.
1917
+ status , err := client .ContainerInspect (context .Background (), ctrID )
1918
+ require .NoError (t , err )
1919
+ require .Equal (t , 254 , status .State .ExitCode )
1912
1920
})
1913
1921
1914
1922
t .Run ("CacheAndPushDevcontainerFeatures" , func (t * testing.T ) {
0 commit comments