@@ -807,3 +807,52 @@ func TestIdentityStore_NewEntityCounter(t *testing.T) {
807
807
808
808
expectSingleCount (t , sink , "identity.entity.creation" )
809
809
}
810
+
811
+ func TestIdentityStore_UpdateAliasMetadataPerAccessor (t * testing.T ) {
812
+ entity := & identity.Entity {
813
+ ID : "testEntityID" ,
814
+ Name : "testEntityName" ,
815
+ Policies : []string {"foo" , "bar" },
816
+ Aliases : []* identity.Alias {
817
+ {
818
+ ID : "testAliasID1" ,
819
+ CanonicalID : "testEntityID" ,
820
+ MountType : "testMountType" ,
821
+ MountAccessor : "testMountAccessor" ,
822
+ Name : "sameAliasName" ,
823
+ },
824
+ {
825
+ ID : "testAliasID2" ,
826
+ CanonicalID : "testEntityID" ,
827
+ MountType : "testMountType" ,
828
+ MountAccessor : "testMountAccessor2" ,
829
+ Name : "sameAliasName" ,
830
+ },
831
+ },
832
+ NamespaceID : namespace .RootNamespaceID ,
833
+ }
834
+
835
+ login := & logical.Alias {
836
+ MountType : "testMountType" ,
837
+ MountAccessor : "testMountAccessor" ,
838
+ Name : "sameAliasName" ,
839
+ ID : "testAliasID" ,
840
+ Metadata : map [string ]string {"foo" : "bar" },
841
+ }
842
+
843
+ if i := changedAliasIndex (entity , login ); i != 0 {
844
+ t .Fatalf ("wrong alias index changed. Expected 0, got %d" , i )
845
+ }
846
+
847
+ login2 := & logical.Alias {
848
+ MountType : "testMountType" ,
849
+ MountAccessor : "testMountAccessor2" ,
850
+ Name : "sameAliasName" ,
851
+ ID : "testAliasID2" ,
852
+ Metadata : map [string ]string {"bar" : "foo" },
853
+ }
854
+
855
+ if i := changedAliasIndex (entity , login2 ); i != 1 {
856
+ t .Fatalf ("wrong alias index changed. Expected 1, got %d" , i )
857
+ }
858
+ }
0 commit comments