@@ -289,7 +289,7 @@ func TestUpdateShare(t *testing.T) {
289289 {
290290 Method : "PATCH" ,
291291 Resource : "/api/2.1/unity-catalog/shares/abc" ,
292- Response : ShareUpdates {
292+ ExpectedRequest : ShareUpdates {
293293 Updates : []ShareDataChange {
294294 {
295295 Action : "REMOVE" ,
@@ -310,7 +310,7 @@ func TestUpdateShare(t *testing.T) {
310310 {
311311 Action : "ADD" ,
312312 DataObject : SharedDataObject {
313- Comment : "d " ,
313+ Comment : "c " ,
314314 DataObjectType : "TABLE" ,
315315 Name : "b" ,
316316 },
@@ -550,3 +550,88 @@ func TestCreateShareButPatchFails(t *testing.T) {
550550 qa .AssertErrorStartsWith (t , err , "Internal error happened" )
551551 assert .Equal (t , "" , d .Id (), "Id should be empty for error creates" )
552552}
553+
554+ func TestUpdateShareComplexDiff (t * testing.T ) {
555+ qa.ResourceFixture {
556+ Fixtures : []qa.HTTPFixture {
557+ {
558+ Method : "GET" ,
559+ Resource : "/api/2.1/unity-catalog/shares/abc?include_shared_data=true" ,
560+ Response : ShareInfo {
561+ Name : "abc" ,
562+ Objects : []SharedDataObject {
563+ {
564+ Name : "a" ,
565+ DataObjectType : "TABLE" ,
566+ Comment : "c" ,
567+ SharedAs : "b" ,
568+ AddedAt : 0 ,
569+ AddedBy : "" ,
570+ },
571+ },
572+ },
573+ },
574+ {
575+ Method : "PATCH" ,
576+ Resource : "/api/2.1/unity-catalog/shares/abc" ,
577+ ExpectedRequest : ShareUpdates {
578+ Updates : []ShareDataChange {
579+ {
580+ Action : "ADD" ,
581+ DataObject : SharedDataObject {
582+ Comment : "c" ,
583+ DataObjectType : "TABLE" ,
584+ Name : "b" ,
585+ },
586+ },
587+ },
588+ },
589+ },
590+ {
591+ Method : "GET" ,
592+ Resource : "/api/2.1/unity-catalog/shares/abc?include_shared_data=true" ,
593+ Response : ShareInfo {
594+ Name : "abc" ,
595+ Objects : []SharedDataObject {
596+ {
597+ Name : "a" ,
598+ DataObjectType : "TABLE" ,
599+ Comment : "c" ,
600+ SharedAs : "" ,
601+ AddedAt : 0 ,
602+ AddedBy : "" ,
603+ },
604+ {
605+ Name : "b" ,
606+ DataObjectType : "TABLE" ,
607+ Comment : "c" ,
608+ SharedAs : "" ,
609+ AddedAt : 0 ,
610+ AddedBy : "" ,
611+ },
612+ },
613+ },
614+ },
615+ },
616+ ID : "abc" ,
617+ Update : true ,
618+ RequiresNew : true ,
619+ InstanceState : map [string ]string {
620+ "name" : "abc" ,
621+ },
622+ HCL : `
623+ name = "abc"
624+ object {
625+ name = "a"
626+ comment = "c"
627+ data_object_type = "TABLE"
628+ }
629+ object {
630+ name = "b"
631+ comment = "c"
632+ data_object_type = "TABLE"
633+ }
634+ ` ,
635+ Resource : ResourceShare (),
636+ }.ApplyNoError (t )
637+ }
0 commit comments