@@ -254,7 +254,7 @@ func Test_Create_Get_Delete_Update_Os(t *testing.T) {
254254 },
255255 }
256256 fieldMask := & fieldmaskpb.FieldMask {
257- Paths : []string {oss .FieldName , oss .FieldInstalledPackages },
257+ Paths : []string {oss .FieldUpdateSources , oss .FieldInstalledPackages },
258258 }
259259 upRes , err := inv_testing .TestClients [inv_testing .APIClient ].Update (
260260 ctx ,
@@ -289,19 +289,10 @@ func Test_Create_Get_Delete_Update_Os(t *testing.T) {
289289}
290290
291291func Test_FilterOss (t * testing.T ) {
292- dao := inv_testing .NewInvResourceDAOOrFail (t )
293- tenantID := uuid .NewString ()
294- cupdatesourceResp1 := dao .CreateOsWithOpts (t , tenantID , true ,
295- inv_testing .Sha256 (inv_testing .RandomSha256v1 ),
296- inv_testing .ProfileName ("Test OS profile name 1" ),
297- inv_testing .Metadata (`{"key1": "value1", "key2": "value2"}` ),
298- inv_testing .SecurityFeature (os_v1 .SecurityFeature_SECURITY_FEATURE_SECURE_BOOT_AND_FULL_DISK_ENCRYPTION ),
299- inv_testing .OsType (os_v1 .OsType_OS_TYPE_MUTABLE ))
300- cupdatesourceResp2 := dao .CreateOsWithOpts (t , tenantID , true ,
301- inv_testing .Sha256 (inv_testing .RandomSha256v2 ),
302- inv_testing .ProfileName ("Test OS profile name 2" ),
303- inv_testing .SecurityFeature (os_v1 .SecurityFeature_SECURITY_FEATURE_NONE ),
304- inv_testing .OsType (os_v1 .OsType_OS_TYPE_MUTABLE ))
292+ cupdatesourceResp1 := inv_testing .CreateOsWithArgs (t , inv_testing .RandomSha256v1 , "Test OS 1" , "Test OS profile name 1" ,
293+ os_v1 .SecurityFeature_SECURITY_FEATURE_SECURE_BOOT_AND_FULL_DISK_ENCRYPTION , os_v1 .OsType_OS_TYPE_MUTABLE )
294+ cupdatesourceResp2 := inv_testing .CreateOsWithArgs (t , inv_testing .RandomSha256v2 , "Test OS 2" , "Test OS profile name 2" ,
295+ os_v1 .SecurityFeature_SECURITY_FEATURE_NONE , os_v1 .OsType_OS_TYPE_MUTABLE )
305296
306297 testcases := map [string ]struct {
307298 in * inv_v1.ResourceFilter
@@ -521,28 +512,16 @@ func Test_UpdateOs(t *testing.T) {
521512 valid bool
522513 expErrorCode codes.Code
523514 }{
524- "UpdateName" : {
525- in : & os_v1.OperatingSystemResource {
526- Name : "Updated Name" ,
527- Sha256 : inv_testing .RandomSha256v3 ,
528- ProfileName : "Test OS profile name 3" ,
529- },
530- resourceID : osResID ,
531- fieldMask : & fieldmaskpb.FieldMask {
532- Paths : []string {oss .FieldName },
533- },
534- valid : true ,
535- },
536515 "UpdateMultipleFields" : {
537516 in : & os_v1.OperatingSystemResource {
538- Name : "Updated Name 2 " ,
517+ Name : "Updated Name" ,
539518 KernelCommand : "linux" ,
540519 UpdateSources : []string {"update 2" },
541520 },
542521 resourceID : osResID ,
543522 fieldMask : & fieldmaskpb.FieldMask {
544523 Paths : []string {
545- oss .FieldKernelCommand , oss .FieldName , oss . FieldUpdateSources ,
524+ oss .FieldKernelCommand , oss .FieldUpdateSources ,
546525 },
547526 },
548527 valid : true ,
@@ -560,6 +539,19 @@ func Test_UpdateOs(t *testing.T) {
560539 valid : false ,
561540 expErrorCode : codes .InvalidArgument ,
562541 },
542+ "UpdateImmutableNameFail" : {
543+ in : & os_v1.OperatingSystemResource {
544+ Name : "Updated Name" ,
545+ },
546+ resourceID : osResID ,
547+ fieldMask : & fieldmaskpb.FieldMask {
548+ Paths : []string {
549+ oss .FieldName ,
550+ },
551+ },
552+ valid : false ,
553+ expErrorCode : codes .InvalidArgument ,
554+ },
563555 "UpdateImmutablePlatformBundleFail" : {
564556 in : & os_v1.OperatingSystemResource {
565557 PlatformBundle : "some platform bundle" ,
@@ -690,7 +682,7 @@ func Test_ImmutableFieldsOnUpdate(t *testing.T) {
690682 osResID := inv_testing .GetResourceIDOrFail (t , cosResp )
691683 t .Cleanup (func () { inv_testing .DeleteResource (t , osResID ) })
692684
693- os1 := inv_testing .CreateOsWithArgs (t , inv_testing .RandomSha256v2 , "Test OS profile name 2" ,
685+ os1 := inv_testing .CreateOsWithArgs (t , inv_testing .RandomSha256v2 , "Test OS 2" , "Test OS profile name 2" ,
694686 os_v1 .SecurityFeature_SECURITY_FEATURE_UNSPECIFIED , os_v1 .OsType_OS_TYPE_MUTABLE )
695687
696688 getresp , err := inv_testing .TestClients [inv_testing .APIClient ].Get (ctx , os1 .ResourceId )
@@ -972,14 +964,13 @@ func Test_Create_Get_Delete_Update_Os_Install_Packages(t *testing.T) {
972964 updateresreq := & inv_v1.Resource {
973965 Resource : & inv_v1.Resource_Os {
974966 Os : & os_v1.OperatingSystemResource {
975- Name : "Updated Name" ,
976967 InstalledPackages : "intel-opencl-icd-updated\n intel-level-zero-gpu-updated\n level-zero-updated" ,
977968 },
978969 },
979970 }
980971
981972 fieldMask := & fieldmaskpb.FieldMask {
982- Paths : []string {oss .FieldName , oss . FieldInstalledPackages },
973+ Paths : []string {oss .FieldInstalledPackages },
983974 }
984975
985976 upRes , err := inv_testing .TestClients [inv_testing .APIClient ].Update (
0 commit comments