@@ -41,25 +41,24 @@ func TestCreateEvaluationEvent_1_3_1_BasicEvent(t *testing.T) {
41
41
t .Errorf ("Expected event name to be 'feature_flag.evaluation', got '%s'" , event .Name )
42
42
}
43
43
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 ])
46
46
}
47
47
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 ])
50
50
}
51
51
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 ])
54
54
}
55
55
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 ])
58
58
}
59
59
}
60
60
61
61
func TestCreateEvaluationEvent_1_4_6_WithVariant (t * testing.T ) {
62
-
63
62
flagKey := "test-flag"
64
63
65
64
mockProviderMetadata := openfeature.Metadata {
@@ -92,15 +91,15 @@ func TestCreateEvaluationEvent_1_4_6_WithVariant(t *testing.T) {
92
91
t .Errorf ("Expected event name to be 'feature_flag.evaluation', got '%s'" , event .Name )
93
92
}
94
93
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 ])
97
96
}
98
97
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 ])
101
100
}
102
-
103
101
}
102
+
104
103
func TestCreateEvaluationEvent_1_4_14_WithFlagMetaData (t * testing.T ) {
105
104
flagKey := "test-flag"
106
105
@@ -124,28 +123,29 @@ func TestCreateEvaluationEvent_1_4_14_WithFlagMetaData(t *testing.T) {
124
123
FlagType : openfeature .Boolean ,
125
124
ResolutionDetail : openfeature.ResolutionDetail {
126
125
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" ,
130
129
},
131
130
},
132
131
},
133
132
}
134
133
135
134
event := CreateEvaluationEvent (mockHookContext , mockDetails )
136
135
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 ])
139
138
}
140
139
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 ])
143
142
}
144
143
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 ])
147
146
}
148
147
}
148
+
149
149
func TestCreateEvaluationEvent_1_4_8_WithErrors (t * testing.T ) {
150
150
flagKey := "test-flag"
151
151
@@ -177,12 +177,12 @@ func TestCreateEvaluationEvent_1_4_8_WithErrors(t *testing.T) {
177
177
178
178
event := CreateEvaluationEvent (mockHookContext , mockDetails )
179
179
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 ])
182
182
}
183
183
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 ])
186
186
}
187
187
}
188
188
@@ -216,14 +216,15 @@ func TestCreateEvaluationEvent_1_4_8_WithGeneralErrors(t *testing.T) {
216
216
217
217
event := CreateEvaluationEvent (mockHookContext , mockDetails )
218
218
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 ])
221
221
}
222
222
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 ])
225
225
}
226
226
}
227
+
227
228
func TestCreateEvaluationEvent_1_4_7_WithUnknownReason (t * testing.T ) {
228
229
flagKey := "test-flag"
229
230
@@ -252,7 +253,7 @@ func TestCreateEvaluationEvent_1_4_7_WithUnknownReason(t *testing.T) {
252
253
253
254
event := CreateEvaluationEvent (mockHookContext , mockDetails )
254
255
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 ])
257
258
}
258
259
}
0 commit comments