Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for the SDKConfig Event; Featurevars is not required. #460

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions harness/features/multithreading.local.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ describe('Multithreading Tests', () => {
etag: null,
rayId: null,
lastModified: null,
skipSDKConfigEvent: true
JamieSinn marked this conversation as resolved.
Show resolved Hide resolved
})
})
})
Expand Down
5 changes: 3 additions & 2 deletions harness/features/track.local.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ describe('Track Tests - Local', () => {
)

expect(eventBody).toEqual({
batch: [
batch: expect.arrayContaining([

...(hasCapability(sdkName, Capabilities.sdkConfigEvent)
? [sdkConfigEventBatch]
: []),
Expand All @@ -162,7 +163,7 @@ describe('Track Tests - Local', () => {
},
],
},
],
]),
})
})

Expand Down
8 changes: 4 additions & 4 deletions harness/helpers/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
type: 'sdkConfig',
target: expect.any(String),
value: expect.any(Number),
featureVars: {
featureVars: expect.toBeOneOf([{
JamieSinn marked this conversation as resolved.
Show resolved Hide resolved
'6386813a59f1b81cc9e6c68d':
'6386813a59f1b81cc9e6c693',
},
}, {}]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we not expecting featureVars to be set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the sdk config event is set under the aggregation user - we don't set featurevars on the aggregation user - as there's no features/variations to have been evaluated.
cc @ajwootto

metaData: expect.objectContaining({
clientUUID: expect.any(String),
resStatus: 200,
Expand Down Expand Up @@ -95,7 +95,7 @@
}
}

expect(body).toEqual({

Check failure on line 98 in harness/helpers/events.ts

View workflow job for this annotation

GitHub Actions / Test Report

harness/features/initialize.local.test.ts ► Initialize Tests - Local ► uses the new config when etag changes, and flushes existing events

Failed test found in: jest-junit.xml Error: Error: expect(received).toEqual(expected) // deep equality
Raw output
Error: expect(received).toEqual(expected) // deep equality

- Expected  -  1
+ Received  + 32

  Object {
-   "batch": toIncludeSameMembers<[object Object]>,
+   "batch": Array [
+     Object {
+       "events": Array [
+         Object {
+           "clientDate": "2024-06-07T16:09:25.264098012Z",
+           "featureVars": Object {},
+           "metaData": Object {
+             "_feature": "638680d6fcb67b96878d90e6",
+             "_variation": "638680d6fcb67b96878d90ec",
+             "clientUUID": "02109315-5508-49fd-aee2-fda3d5e81005",
+             "configEtag": "first-etag",
+             "configLastModified": "Fri, 07 Jun 2024 16:09:13 GMT",
+             "configRayId": "first-ray",
+           },
+           "target": "number-var",
+           "type": "aggVariableEvaluated",
+           "user_id": "f7e1f0ec1c0a",
+           "value": 1,
+         },
+       ],
+       "user": Object {
+         "createdDate": "2024-06-07T16:09:25.264107189Z",
+         "hostname": "f7e1f0ec1c0a",
+         "lastSeenDate": "0001-01-01T00:00:00Z",
+         "platform": "Go",
+         "platformVersion": "go1.22.2",
+         "sdkType": "server",
+         "sdkVersion": "2.15.0",
+         "user_id": "f7e1f0ec1c0a",
+       },
+     },
+   ],
  }
    at expectAggregateEvaluationEvent (/home/runner/work/test-harness/test-harness/harness/helpers/events.ts:98:18)
    at Object.<anonymous> (/home/runner/work/test-harness/test-harness/harness/features/initialize.local.test.ts:473:43)

Check failure on line 98 in harness/helpers/events.ts

View workflow job for this annotation

GitHub Actions / Test Report

harness/features/multithreading.local.test.ts ► Multithreading Tests › Go › initialized client ► should return variable if SDK returns object matching default type

Failed test found in: jest-junit.xml Error: Error: expect(received).toEqual(expected) // deep equality
Raw output
Error: expect(received).toEqual(expected) // deep equality

- Expected  -  1
+ Received  + 32

  Object {
-   "batch": toIncludeSameMembers<[object Object]>,
+   "batch": Array [
+     Object {
+       "events": Array [
+         Object {
+           "clientDate": "2024-06-07T16:09:36.896247228Z",
+           "featureVars": Object {},
+           "metaData": Object {
+             "_feature": "638680d6fcb67b96878d90e6",
+             "_variation": "638680d6fcb67b96878d90ec",
+             "clientUUID": "f5610b77-9f21-4290-b7d2-b7f33e112178",
+             "configEtag": "multithreading-etag",
+             "configLastModified": "Fri, 07 Jun 2024 16:09:36 GMT",
+             "configRayId": "multithreading-rayid",
+           },
+           "target": "string-var",
+           "type": "aggVariableEvaluated",
+           "user_id": "f7e1f0ec1c0a",
+           "value": 1,
+         },
+       ],
+       "user": Object {
+         "createdDate": "2024-06-07T16:09:36.896252308Z",
+         "hostname": "f7e1f0ec1c0a",
+         "lastSeenDate": "0001-01-01T00:00:00Z",
+         "platform": "Go",
+         "platformVersion": "go1.22.2",
+         "sdkType": "server",
+         "sdkVersion": "2.15.0",
+         "user_id": "f7e1f0ec1c0a",
+       },
+     },
+   ],
  }
    at expectAggregateEvaluationEvent (/home/runner/work/test-harness/test-harness/harness/helpers/events.ts:98:18)
    at Object.<anonymous> (/home/runner/work/test-harness/test-harness/harness/features/multithreading.local.test.ts:104:47)
batch: expect.toIncludeSameMembers([
...optionalSDKConfigNewUser,
{
Expand Down Expand Up @@ -182,7 +182,7 @@
}

expect(body).toEqual({
batch: expect.toIncludeSameMembers([
batch: expect.arrayContaining([
...optionalSDKConfigNewUser,
{
user: {
Expand All @@ -191,7 +191,7 @@
platform: expectedPlatform,
sdkType: 'server',
},
events: expect.toIncludeSameMembers([
events: expect.arrayContaining([
...optionalSDKConfigNewEvent,
{
...optionalEventFields,
Expand Down
2 changes: 1 addition & 1 deletion proxies/go/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/devcyclehq/test-harness/proxies/go

go 1.22
go 1.22.2

require (
github.com/devcyclehq/go-server-sdk/v2 v2.14.0
Expand Down
Loading