@@ -1014,12 +1014,9 @@ func TestGetUserAttributeKeys(t *testing.T) {
10141014 req := & gatewayproto.RegisterEventsRequest {
10151015 Events : []* eventproto.Event {
10161016 {
1017- Id : newUUID (t ),
1018- Event : evaluation1 ,
1019- },
1020- {
1021- Id : newUUID (t ),
1022- Event : evaluation2 ,
1017+ Id : newUUID (t ),
1018+ Event : evaluation1 ,
1019+ EnvironmentId : environmentId ,
10231020 },
10241021 },
10251022 }
@@ -1031,6 +1028,25 @@ func TestGetUserAttributeKeys(t *testing.T) {
10311028 t .Fatalf ("Failed to register events. Error: %v" , response .Errors )
10321029 }
10331030
1031+ time .Sleep (time .Duration (sleepSecond ) * time .Second )
1032+
1033+ req2 := & gatewayproto.RegisterEventsRequest {
1034+ Events : []* eventproto.Event {
1035+ {
1036+ Id : newUUID (t ),
1037+ Event : evaluation2 ,
1038+ EnvironmentId : environmentId ,
1039+ },
1040+ },
1041+ }
1042+ response2 , err := c .RegisterEvents (ctx , req2 )
1043+ if err != nil {
1044+ t .Fatal (err )
1045+ }
1046+ if len (response2 .Errors ) > 0 {
1047+ t .Fatalf ("Failed to register events. Error: %v" , response2 .Errors )
1048+ }
1049+
10341050 // Check that all 6 attributes are found
10351051 expectedAttributes := []string {
10361052 testUserDataKeySuffix + "attr1-" + uuid ,
@@ -1043,6 +1059,8 @@ func TestGetUserAttributeKeys(t *testing.T) {
10431059
10441060 foundAttributes := make (map [string ]bool )
10451061 for i := 0 ; i < maxRetryCount ; i ++ {
1062+ time .Sleep (time .Duration (sleepSecond ) * time .Second ) // Wait for cache to update
1063+
10461064 // Test GetUserAttributeKeys API
10471065 userAttrReq := & featureproto.GetUserAttributeKeysRequest {
10481066 EnvironmentId : environmentId ,
@@ -1065,8 +1083,6 @@ func TestGetUserAttributeKeys(t *testing.T) {
10651083 if len (foundAttributes ) == len (expectedAttributes ) {
10661084 break
10671085 }
1068-
1069- time .Sleep (time .Duration (sleepSecond ) * time .Second ) // Wait for cache to update
10701086 }
10711087
10721088 // Verify all expected attributes were found
0 commit comments