Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
0434310c
Unverified
Commit
0434310c
authored
1 year ago
by
Cam Saul
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix Snowflake test reflection warnings (#30918)
parent
338666fa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/metabase/analytics/snowplow_test.clj
+13
-9
13 additions, 9 deletions
test/metabase/analytics/snowplow_test.clj
with
13 additions
and
9 deletions
test/metabase/analytics/snowplow_test.clj
+
13
−
9
View file @
0434310c
...
...
@@ -12,6 +12,8 @@
[
metabase.util.date-2
:as
u.date
]
[
toucan2.core
:as
t2
])
(
:import
(
com.snowplowanalytics.snowplow.tracker.events
SelfDescribing
)
(
com.snowplowanalytics.snowplow.tracker.payload
SelfDescribingJson
)
(
java.util
LinkedHashMap
)))
(
set!
*warn-on-reflection*
true
)
...
...
@@ -30,15 +32,17 @@
(
defn-
fake-track-event-impl!
"A function that can be used in place of track-event-impl! which pulls and decodes the payload, context and subject ID
from an event and adds it to the in-memory [[*snowplow-collector*]] queue."
[
collector
_
event
]
(
let
[
payload
(
->
event
.getPayload
.getMap
normalize-map
)
;; Don't normalize keys in [[properties]] so that we can assert that they are snake-case strings in the test cases
properties
(
->
(
or
(
:ue_pr
payload
)
(
u/decode-base64
(
:ue_px
payload
)))
json/parse-string
)
subject
(
when-let
[
subject
(
.getSubject
event
)]
(
->
subject
.getSubject
normalize-map
))
context
(
->>
event
.getContext
first
.getMap
normalize-map
)]
[
collector
_tracker
^
SelfDescribing
event
]
(
let
[
payload
(
->
event
.getPayload
.getMap
normalize-map
)
;; Don't normalize keys in [[properties]] so that we can assert that they are snake-case strings in the test
;; cases
properties
(
->
(
or
(
:ue_pr
payload
)
(
u/decode-base64
(
:ue_px
payload
)))
json/parse-string
)
subject
(
when-let
[
subject
(
.getSubject
event
)]
(
->
subject
.getSubject
normalize-map
))
[
^
SelfDescribingJson
context-json
]
(
.getContext
event
)
context
(
normalize-map
(
.getMap
context-json
))]
(
swap!
collector
conj
{
:properties
properties,
:subject
subject,
:context
context
})))
(
defn
do-with-fake-snowplow-collector
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment