@@ -41,25 +41,24 @@ func TestCreateEvaluationEvent_1_3_1_BasicEvent(t *testing.T) {
4141 t .Errorf ("Expected event name to be 'feature_flag.evaluation', got '%s'" , event .Name )
4242 }
4343
44- if event .Attributes [TelemetryKey ] != flagKey {
45- t .Errorf ("Expected event attribute 'KEY' to be '%s', got '%s'" , flagKey , event .Attributes [TelemetryKey ])
44+ if event .Attributes [FlagKey ] != flagKey {
45+ t .Errorf ("Expected event attribute 'KEY' to be '%s', got '%s'" , flagKey , event .Attributes [FlagKey ])
4646 }
4747
48- if event .Attributes [TelemetryReason ] != strings .ToLower (string (openfeature .StaticReason )) {
49- t .Errorf ("Expected evaluation reason to be '%s', got '%s'" , strings .ToLower (string (openfeature .StaticReason )), event .Attributes [TelemetryReason ])
48+ if event .Attributes [ResultReasonKey ] != strings .ToLower (string (openfeature .StaticReason )) {
49+ t .Errorf ("Expected evaluation reason to be '%s', got '%s'" , strings .ToLower (string (openfeature .StaticReason )), event .Attributes [ResultReasonKey ])
5050 }
5151
52- if event .Attributes [TelemetryProvider ] != "test-provider" {
53- t .Errorf ("Expected provider name to be 'test-provider', got '%s'" , event .Attributes [TelemetryProvider ])
52+ if event .Attributes [ProviderNameKey ] != "test-provider" {
53+ t .Errorf ("Expected provider name to be 'test-provider', got '%s'" , event .Attributes [ProviderNameKey ])
5454 }
5555
56- if event .Body [ TelemetryBody ] != true {
57- t .Errorf ("Expected event body 'VALUE' to be 'true', got '%v'" , event .Body [ TelemetryBody ])
56+ if event .Attributes [ ResultValueKey ] != true {
57+ t .Errorf ("Expected event attribute 'VALUE' to be 'true', got '%v'" , event .Attributes [ ResultValueKey ])
5858 }
5959}
6060
6161func TestCreateEvaluationEvent_1_4_6_WithVariant (t * testing.T ) {
62-
6362 flagKey := "test-flag"
6463
6564 mockProviderMetadata := openfeature.Metadata {
@@ -92,15 +91,15 @@ func TestCreateEvaluationEvent_1_4_6_WithVariant(t *testing.T) {
9291 t .Errorf ("Expected event name to be 'feature_flag.evaluation', got '%s'" , event .Name )
9392 }
9493
95- if event .Attributes [TelemetryKey ] != flagKey {
96- t .Errorf ("Expected event attribute 'KEY' to be '%s', got '%s'" , flagKey , event .Attributes [TelemetryKey ])
94+ if event .Attributes [FlagKey ] != flagKey {
95+ t .Errorf ("Expected event attribute 'KEY' to be '%s', got '%s'" , flagKey , event .Attributes [FlagKey ])
9796 }
9897
99- if event .Attributes [TelemetryVariant ] != "true" {
100- t .Errorf ("Expected event attribute 'VARIANT' to be 'true', got '%s'" , event .Attributes [TelemetryVariant ])
98+ if event .Attributes [ResultVariantKey ] != "true" {
99+ t .Errorf ("Expected event attribute 'VARIANT' to be 'true', got '%s'" , event .Attributes [ResultVariantKey ])
101100 }
102-
103101}
102+
104103func TestCreateEvaluationEvent_1_4_14_WithFlagMetaData (t * testing.T ) {
105104 flagKey := "test-flag"
106105
@@ -124,28 +123,29 @@ func TestCreateEvaluationEvent_1_4_14_WithFlagMetaData(t *testing.T) {
124123 FlagType : openfeature .Boolean ,
125124 ResolutionDetail : openfeature.ResolutionDetail {
126125 FlagMetadata : openfeature.FlagMetadata {
127- TelemetryFlagMetaFlagSetId : "test-set" ,
128- TelemetryFlagMetaContextId : "metadata-context" ,
129- TelemetryFlagMetaVersion : "v1.0" ,
126+ flagMetaFlagSetIDKey : "test-set" ,
127+ flagMetaContextIDKey : "metadata-context" ,
128+ flagMetaVersionKey : "v1.0" ,
130129 },
131130 },
132131 },
133132 }
134133
135134 event := CreateEvaluationEvent (mockHookContext , mockDetails )
136135
137- if event .Attributes [TelemetryFlagSetID ] != "test-set" {
138- t .Errorf ("Expected 'Flag SetID' in Flag Metadata name to be 'test-set', got '%s'" , event .Attributes [TelemetryFlagMetaFlagSetId ])
136+ if event .Attributes [FlagSetIDKey ] != "test-set" {
137+ t .Errorf ("Expected 'Flag SetID' in Flag Metadata name to be 'test-set', got '%s'" , event .Attributes [flagMetaFlagSetIDKey ])
139138 }
140139
141- if event .Attributes [TelemetryContextID ] != "metadata-context" {
142- t .Errorf ("Expected 'Flag ContextID' in Flag Metadata name to be 'metadata-context', got '%s'" , event .Attributes [TelemetryFlagMetaContextId ])
140+ if event .Attributes [ContextIDKey ] != "metadata-context" {
141+ t .Errorf ("Expected 'Flag ContextID' in Flag Metadata name to be 'metadata-context', got '%s'" , event .Attributes [flagMetaContextIDKey ])
143142 }
144143
145- if event .Attributes [TelemetryVersion ] != "v1.0" {
146- t .Errorf ("Expected 'Flag Version' in Flag Metadata name to be 'v1.0', got '%s'" , event .Attributes [TelemetryFlagMetaVersion ])
144+ if event .Attributes [VersionKey ] != "v1.0" {
145+ t .Errorf ("Expected 'Flag Version' in Flag Metadata name to be 'v1.0', got '%s'" , event .Attributes [flagMetaVersionKey ])
147146 }
148147}
148+
149149func TestCreateEvaluationEvent_1_4_8_WithErrors (t * testing.T ) {
150150 flagKey := "test-flag"
151151
@@ -177,12 +177,12 @@ func TestCreateEvaluationEvent_1_4_8_WithErrors(t *testing.T) {
177177
178178 event := CreateEvaluationEvent (mockHookContext , mockDetails )
179179
180- if event .Attributes [TelemetryErrorCode ] != openfeature .FlagNotFoundCode {
181- t .Errorf ("Expected 'ERROR_CODE' to be 'GENERAL', got '%s'" , event .Attributes [TelemetryErrorCode ])
180+ if event .Attributes [ErrorTypeKey ] != strings . ToLower ( string ( openfeature .FlagNotFoundCode )) {
181+ t .Errorf ("Expected 'ERROR_CODE' to be 'GENERAL', got '%s'" , event .Attributes [ErrorTypeKey ])
182182 }
183183
184- if event .Attributes [TelemetryErrorMsg ] != "a test error" {
185- t .Errorf ("Expected 'ERROR_MESSAGE' to be 'a test error', got '%s'" , event .Attributes [TelemetryErrorMsg ])
184+ if event .Attributes [ErrorMessageKey ] != "a test error" {
185+ t .Errorf ("Expected 'ERROR_MESSAGE' to be 'a test error', got '%s'" , event .Attributes [ErrorMessageKey ])
186186 }
187187}
188188
@@ -216,14 +216,15 @@ func TestCreateEvaluationEvent_1_4_8_WithGeneralErrors(t *testing.T) {
216216
217217 event := CreateEvaluationEvent (mockHookContext , mockDetails )
218218
219- if event .Attributes [TelemetryErrorCode ] != openfeature .GeneralCode {
220- t .Errorf ("Expected 'ERROR_CODE' to be 'GENERAL', got '%s'" , event .Attributes [TelemetryErrorCode ])
219+ if event .Attributes [ErrorTypeKey ] != strings . ToLower ( string ( openfeature .GeneralCode )) {
220+ t .Errorf ("Expected 'ERROR_CODE' to be 'GENERAL', got '%s'" , event .Attributes [ErrorTypeKey ])
221221 }
222222
223- if event .Attributes [TelemetryErrorMsg ] != "a test error" {
224- t .Errorf ("Expected 'ERROR_MESSAGE' to be 'a test error', got '%s'" , event .Attributes [TelemetryErrorMsg ])
223+ if event .Attributes [ErrorMessageKey ] != "a test error" {
224+ t .Errorf ("Expected 'ERROR_MESSAGE' to be 'a test error', got '%s'" , event .Attributes [ErrorMessageKey ])
225225 }
226226}
227+
227228func TestCreateEvaluationEvent_1_4_7_WithUnknownReason (t * testing.T ) {
228229 flagKey := "test-flag"
229230
@@ -252,7 +253,7 @@ func TestCreateEvaluationEvent_1_4_7_WithUnknownReason(t *testing.T) {
252253
253254 event := CreateEvaluationEvent (mockHookContext , mockDetails )
254255
255- if event .Attributes [TelemetryReason ] != strings .ToLower (string (openfeature .UnknownReason )) {
256- t .Errorf ("Expected evaluation reason to be '%s', got '%s'" , strings .ToLower (string (openfeature .UnknownReason )), event .Attributes [TelemetryReason ])
256+ if event .Attributes [ResultReasonKey ] != strings .ToLower (string (openfeature .UnknownReason )) {
257+ t .Errorf ("Expected evaluation reason to be '%s', got '%s'" , strings .ToLower (string (openfeature .UnknownReason )), event .Attributes [ResultReasonKey ])
257258 }
258259}
0 commit comments