@@ -745,18 +745,14 @@ public void EndToEndMultiArch_LocalRegistry()
745
745
. WithWorkingDirectory ( newProjectDir . FullName )
746
746
. Execute ( ) ;
747
747
748
- // Check that the app was published for each RID,
749
- // one image was created locally
748
+ // Check that the app was published for each RID, one image was created locally
750
749
commandResult . Should ( ) . Pass ( )
751
750
. And . HaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-x64" ) )
752
751
. And . HaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-arm64" ) )
753
752
. And . HaveStdOutContaining ( $ "Building image '{ imageName } ' for runtime identifier 'linux-x64'")
754
753
. And . HaveStdOutContaining ( $ "Building image '{ imageName } ' for runtime identifier 'linux-arm64'")
755
754
. And . HaveStdOutContaining ( $ "Pushed image '{ image } ' to local registry") ;
756
755
757
- //Multi-arch oci tarballs that are loaded to docker can only be run by their image id
758
- string imageId = GetImageId ( image ) ;
759
-
760
756
// Check that the containers can be run
761
757
CommandResult processResultX64 = ContainerCli . RunCommand (
762
758
_testOutput ,
@@ -765,7 +761,7 @@ public void EndToEndMultiArch_LocalRegistry()
765
761
"linux/amd64" ,
766
762
"--name" ,
767
763
$ "test-container-{ imageName } -x64",
768
- imageId )
764
+ image )
769
765
. Execute ( ) ;
770
766
processResultX64 . Should ( ) . Pass ( ) . And . HaveStdOut ( "Hello, World!" ) ;
771
767
@@ -776,27 +772,14 @@ public void EndToEndMultiArch_LocalRegistry()
776
772
"linux/arm64" ,
777
773
"--name" ,
778
774
$ "test-container-{ imageName } -arm64",
779
- imageId )
775
+ image )
780
776
. Execute ( ) ;
781
777
processResultArm64 . Should ( ) . Pass ( ) . And . HaveStdOut ( "Hello, World!" ) ;
782
778
783
779
// Cleanup
784
780
newProjectDir . Delete ( true ) ;
785
781
}
786
782
787
- private string GetImageId ( string image )
788
- {
789
- CommandResult commandResult = ContainerCli . ImagesCommand ( _testOutput , "--format" , "\" {{.ID}}\" " , image )
790
- . Execute ( ) ;
791
- commandResult . Should ( ) . Pass ( ) ;
792
-
793
- var output = commandResult . StdOut . Split ( "\n " ) . Select ( s => s . Trim ( '"' ) ) . ToList ( ) ;
794
-
795
- output . Should ( ) . NotBeNullOrEmpty ( ) . And . OnlyContain ( s => s == output [ 0 ] ) ;
796
-
797
- return output [ 0 ] ;
798
- }
799
-
800
783
[ DockerAvailableFact ]
801
784
public void MultiArchStillAllowsSingleRID ( )
802
785
{
@@ -948,26 +931,22 @@ public void EndToEndMultiArch_ArchivePublishing()
948
931
. WithWorkingDirectory ( newProjectDir . FullName )
949
932
. Execute ( ) ;
950
933
951
- // Check that the app was published for each RID,
952
- // one image was created in local archive
934
+ // Check that the app was published for each RID, one image was created in local archive
953
935
commandResult . Should ( ) . Pass ( )
954
936
. And . HaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-x64" ) )
955
937
. And . HaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-arm64" ) )
956
938
. And . HaveStdOutContaining ( $ "Building image '{ imageName } ' for runtime identifier 'linux-x64'")
957
939
. And . HaveStdOutContaining ( $ "Building image '{ imageName } ' for runtime identifier 'linux-arm64'")
958
940
. And . HaveStdOutContaining ( $ "Pushed image '{ image } ' to local archive at '{ imageTarball } '") ;
959
941
960
- // Check that tarballs were created
942
+ // Check that tarball were created
961
943
File . Exists ( imageTarball ) . Should ( ) . BeTrue ( ) ;
962
944
963
945
// Load the multi-arch image from the tarball
964
946
ContainerCli . LoadCommand ( _testOutput , "--input" , imageTarball )
965
947
. Execute ( )
966
948
. Should ( ) . Pass ( ) ;
967
949
968
- //Multi-arch oci tarballs that are loaded to docker can only be run by their image id
969
- string imageId = GetImageId ( image ) ;
970
-
971
950
// Check that the containers can be run
972
951
CommandResult processResultX64 = ContainerCli . RunCommand (
973
952
_testOutput ,
@@ -976,7 +955,7 @@ public void EndToEndMultiArch_ArchivePublishing()
976
955
"linux/amd64" ,
977
956
"--name" ,
978
957
$ "test-container-{ imageName } -x64",
979
- imageId )
958
+ image )
980
959
. Execute ( ) ;
981
960
processResultX64 . Should ( ) . Pass ( ) . And . HaveStdOut ( "Hello, World!" ) ;
982
961
@@ -987,7 +966,7 @@ public void EndToEndMultiArch_ArchivePublishing()
987
966
"linux/arm64" ,
988
967
"--name" ,
989
968
$ "test-container-{ imageName } -arm64",
990
- imageId )
969
+ image )
991
970
. Execute ( ) ;
992
971
processResultArm64 . Should ( ) . Pass ( ) . And . HaveStdOut ( "Hello, World!" ) ;
993
972
@@ -1024,15 +1003,16 @@ public void EndToEndMultiArch_RemoteRegistry()
1024
1003
. Execute ( ) ;
1025
1004
1026
1005
// Check that the app was published for each RID,
1027
- // images were created locally for each RID
1028
- // and image index was created
1006
+ // images for each RID were pushed to remote registry
1007
+ // and image index was pushed to remote registry
1029
1008
commandResult . Should ( ) . Pass ( )
1030
1009
. And . HaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-x64" ) )
1031
1010
. And . HaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-arm64" ) )
1032
1011
. And . HaveStdOutContaining ( $ "Pushed image '{ imageX64 } ' to registry '{ registry } '.")
1033
1012
. And . HaveStdOutContaining ( $ "Pushed image '{ imageArm64 } ' to registry '{ registry } '.")
1034
1013
. And . HaveStdOutContaining ( $ "Pushed image index '{ imageIndex } ' to registry '{ registry } '.") ;
1035
1014
1015
+ // Check that the containers can be run
1036
1016
// First pull the image from the registry for each platform
1037
1017
ContainerCli . PullCommand (
1038
1018
_testOutput ,
@@ -1048,8 +1028,8 @@ public void EndToEndMultiArch_RemoteRegistry()
1048
1028
imageFromRegistry )
1049
1029
. Execute ( )
1050
1030
. Should ( ) . Pass ( ) ;
1051
-
1052
- // Check that the containers can be run
1031
+
1032
+ // Run the containers
1053
1033
ContainerCli . RunCommand (
1054
1034
_testOutput ,
1055
1035
"--rm" ,
@@ -1097,7 +1077,7 @@ public void EndToEndMultiArch_ContainerRuntimeIdentifiersOverridesRuntimeIdentif
1097
1077
. Execute ( ) ;
1098
1078
1099
1079
// Check that the app was published only for RID from ContainerRuntimeIdentifiers
1100
- // images were created locally only for RID for from ContainerRuntimeIdentifiers
1080
+ // images were built only for RID for from ContainerRuntimeIdentifiers
1101
1081
commandResult . Should ( ) . Pass ( )
1102
1082
. And . NotHaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-x64" ) )
1103
1083
. And . HaveStdOutContaining ( GetPublishArtifactsPath ( newProjectDir . FullName , "linux-arm64" ) )
@@ -1148,8 +1128,6 @@ public void EndToEndMultiArch_EnvVariables()
1148
1128
. Execute ( )
1149
1129
. Should ( ) . Pass ( ) ;
1150
1130
1151
- string imageId = GetImageId ( image ) ;
1152
-
1153
1131
// Check that the env var is printed for linux/amd64 platform
1154
1132
string containerNameX64 = $ "test-container-{ imageName } -x64";
1155
1133
CommandResult processResultX64 = ContainerCli . RunCommand (
@@ -1159,7 +1137,7 @@ public void EndToEndMultiArch_EnvVariables()
1159
1137
"linux/amd64" ,
1160
1138
"--name" ,
1161
1139
containerNameX64 ,
1162
- imageId )
1140
+ image )
1163
1141
. Execute ( ) ;
1164
1142
processResultX64 . Should ( ) . Pass ( ) . And . HaveStdOut ( "FooBar" ) ;
1165
1143
@@ -1172,7 +1150,7 @@ public void EndToEndMultiArch_EnvVariables()
1172
1150
"linux/arm64" ,
1173
1151
"--name" ,
1174
1152
containerNameArm64 ,
1175
- imageId )
1153
+ image )
1176
1154
. Execute ( ) ;
1177
1155
processResultArm64 . Should ( ) . Pass ( ) . And . HaveStdOut ( "FooBar" ) ;
1178
1156
@@ -1215,8 +1193,6 @@ public void EndToEndMultiArch_Ports()
1215
1193
. Execute ( )
1216
1194
. Should ( ) . Pass ( ) ;
1217
1195
1218
- string imageId = GetImageId ( image ) ;
1219
-
1220
1196
// Check that the ports are correct for linux/amd64 platform
1221
1197
var containerNameX64 = $ "test-container-{ imageName } -x64";
1222
1198
CommandResult processResultX64 = ContainerCli . RunCommand (
@@ -1228,7 +1204,7 @@ public void EndToEndMultiArch_Ports()
1228
1204
containerNameX64 ,
1229
1205
"-P" ,
1230
1206
"--detach" ,
1231
- imageId )
1207
+ image )
1232
1208
. Execute ( ) ;
1233
1209
processResultX64 . Should ( ) . Pass ( ) ;
1234
1210
@@ -1246,7 +1222,7 @@ public void EndToEndMultiArch_Ports()
1246
1222
containerNameArm64 ,
1247
1223
"-P" ,
1248
1224
"--detach" ,
1249
- imageId )
1225
+ image )
1250
1226
. Execute ( ) ;
1251
1227
processResultArm64 . Should ( ) . Pass ( ) ;
1252
1228
@@ -1304,13 +1280,11 @@ public void EndToEndMultiArch_Labels()
1304
1280
. Execute ( )
1305
1281
. Should ( ) . Pass ( ) ;
1306
1282
1307
- string imageId = GetImageId ( image ) ;
1308
-
1309
1283
// Check that labels are set
1310
1284
CommandResult inspectResult = ContainerCli . InspectCommand (
1311
1285
_testOutput ,
1312
1286
"--format={{json .Config.Labels}}" ,
1313
- imageId )
1287
+ image )
1314
1288
. Execute ( ) ;
1315
1289
inspectResult . Should ( ) . Pass ( ) ;
1316
1290
var labels = JsonSerializer . Deserialize < Dictionary < string , string > > ( inspectResult . StdOut ) ;
0 commit comments