@@ -961,6 +961,91 @@ func TestApplier_ApplyLayers(t *testing.T) {
961
961
},
962
962
wantErr : "unknown OS" ,
963
963
},
964
+ {
965
+ name : "SUSE images - legacy OS name with backward compatibility" ,
966
+ args : args {
967
+ imageID : "sha256:fb44d01953611ba18d43d88e158c25579d18eff42db671182245010620a283f3" ,
968
+ layerIDs : []string {
969
+ "sha256:2615f175cf3da67c48c6542914744943ee5e9c253547b03e3cfe8aae605c3199" ,
970
+ },
971
+ },
972
+ getLayerExpectations : []cache.LocalArtifactCacheGetBlobExpectation {
973
+ {
974
+ Args : cache.LocalArtifactCacheGetBlobArgs {
975
+ BlobID : "sha256:2615f175cf3da67c48c6542914744943ee5e9c253547b03e3cfe8aae605c3199" ,
976
+ },
977
+ Returns : cache.LocalArtifactCacheGetBlobReturns {
978
+ BlobInfo : types.BlobInfo {
979
+ SchemaVersion : 1 ,
980
+ Digest : "sha256:fb44d01953611ba18d43d88e158c25579d18eff42db671182245010620a283f3" ,
981
+ DiffID : "sha256:d555e1b0b42f21a1cf198e52bcb12fe66aa015348e4390d2d5acddd327d79073" ,
982
+ OS : types.OS {
983
+ Family : "suse linux enterprise server" ,
984
+ Name : "15.4" ,
985
+ },
986
+ PackageInfos : []types.PackageInfo {
987
+ {
988
+ FilePath : "usr/lib/sysimage/rpm/Packages.db" ,
989
+ Packages : types.Packages {
990
+ {
991
+ Name : "curl" ,
992
+ Version : "7.79.1" ,
993
+ SrcName : "curl" ,
994
+ SrcVersion : "7.79.1" ,
995
+ },
996
+ },
997
+ },
998
+ },
999
+ },
1000
+ },
1001
+ },
1002
+ },
1003
+ getArtifactExpectations : []cache.LocalArtifactCacheGetArtifactExpectation {
1004
+ {
1005
+ Args : cache.LocalArtifactCacheGetArtifactArgs {
1006
+ ArtifactID : "sha256:fb44d01953611ba18d43d88e158c25579d18eff42db671182245010620a283f3" ,
1007
+ },
1008
+ Returns : cache.LocalArtifactCacheGetArtifactReturns {
1009
+ ArtifactInfo : types.ArtifactInfo {
1010
+ SchemaVersion : 1 ,
1011
+ },
1012
+ },
1013
+ },
1014
+ },
1015
+ want : types.ArtifactDetail {
1016
+ OS : types.OS {
1017
+ Family : "sles" ,
1018
+ Name : "15.4" ,
1019
+ },
1020
+ Packages : types.Packages {
1021
+ {
1022
+ Name : "curl" ,
1023
+ Version : "7.79.1" ,
1024
+ SrcName : "curl" ,
1025
+ SrcVersion : "7.79.1" ,
1026
+ Identifier : types.PkgIdentifier {
1027
+ UID : "1e9b3d3a73785651" ,
1028
+ PURL : & packageurl.PackageURL {
1029
+ Type : packageurl .TypeRPM ,
1030
+ Namespace : "suse" ,
1031
+ Name : "curl" ,
1032
+ Version : "7.79.1" ,
1033
+ Qualifiers : packageurl.Qualifiers {
1034
+ {
1035
+ Key : "distro" ,
1036
+ Value : "sles-15.4" ,
1037
+ },
1038
+ },
1039
+ },
1040
+ },
1041
+ Layer : types.Layer {
1042
+ Digest : "sha256:fb44d01953611ba18d43d88e158c25579d18eff42db671182245010620a283f3" ,
1043
+ DiffID : "sha256:d555e1b0b42f21a1cf198e52bcb12fe66aa015348e4390d2d5acddd327d79073" ,
1044
+ },
1045
+ },
1046
+ },
1047
+ },
1048
+ },
964
1049
}
965
1050
for _ , tt := range tests {
966
1051
t .Run (tt .name , func (t * testing.T ) {
0 commit comments