Skip to content

Bugfix/metrics dispatcher cicd #131

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

Merged
merged 20 commits into from
Jul 9, 2024
Merged

Conversation

melekr
Copy link
Collaborator

@melekr melekr commented Jul 4, 2024

This diff contains the following updates:

  • Fixes metrics, dispatcher and watcher Tests
  • Fixes Tests failures when running fastlane actions
  • Fixes issue with runner timeout when waiting for emulator
  • Raises ios & tvos DEPLOYMENT_TARGET to 12.0 and resolves build warnings
  • Sets ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to use inherited properties and resolves build warnings
  • Removes LocationInfo attributes

ref: BT-3005

@melekr melekr force-pushed the bugfix/metrics-dispatcher-cicd branch from 7db5967 to e5f2ab2 Compare July 4, 2024 19:44
@melekr melekr force-pushed the bugfix/metrics-dispatcher-cicd branch from e5f2ab2 to 4f57ead Compare July 4, 2024 19:46
@melekr melekr requested a review from konraddysput July 4, 2024 19:56
@melekr melekr marked this pull request as ready for review July 4, 2024 19:57
@konraddysput konraddysput added the bug Something isn't working label Jul 5, 2024
"location.enabled": CLLocationManager.locationServicesEnabled(),
"location.authorization.status": CLLocationManager.authorizationStatus().name
]
var mutableDict = [String: Any?]()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it won't work. The location information won't be returned on line 214 but will be generated later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

seemed to work when I tested, I'll double check.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we should remove it because it doesn't make sense to keep it and this is not something our customers want to use. If they want (their clients need to agree to use location services) then can pass them to use via attribuets


beforeEach {
metrics = BacktraceMetrics(api: backtraceApi)
metrics?.enable(settings: BacktraceMetricsSettings())
Copy link
Collaborator

Choose a reason for hiding this comment

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

enable method should generate a summed + unique event. Are you sure we're testing the right thing? Maybe we should clear summed events if we want to test unique? I think its worth testing if the default summed +unique events are generated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

all I did was cleanup by moving metrics init and enable to beforeEach.
Tests premises remain unchanged.
I added clearSummedEvents to test but it's not needed at all. I'll revert tests to the way they were.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we're not testing the most important functionality, which is checking if the unique/summed event will be generated on the app startup. Maybe we can move cleanup method to each test and allow the test to decide what is the behavior under the test?


it("clears the summed event after enabling and sending") {
// Allow default events to be "sent" out
expect { metrics?.count }.toEventually(equal(1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

why 1? I think its becuase the unique event is still there. Maybe we can do better and get all events and filter them by checking the event type? Maybe it is just enough if we move 1 to variable and call it expectedNumberOfEvents

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should verify it the number of summed events is 1. metrics.count will return number of events in the queue (unique + summed)


beforeEach {
metrics = BacktraceMetrics(api: backtraceApi)
metrics?.enable(settings: BacktraceMetricsSettings())
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we're not testing the most important functionality, which is checking if the unique/summed event will be generated on the app startup. Maybe we can move cleanup method to each test and allow the test to decide what is the behavior under the test?


it("clears the summed event after enabling and sending") {
// Allow default events to be "sent" out
expect { metrics?.count }.toEventually(equal(1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should verify it the number of summed events is 1. metrics.count will return number of events in the queue (unique + summed)

Comment on lines 36 to 37
metrics?.addSummedEvent(name: summedEventName)
expect { metrics?.count }.to(equal(2))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the test is about to verify if the number of tests added to the queue will increase. I think that's the better way to verify that. We shouldn't think about hard coded numbers but rather about the behavior

Suggested change
metrics?.addSummedEvent(name: summedEventName)
expect { metrics?.count }.to(equal(2))
let count = metrics?.count
metrics?.addSummedEvent(name: summedEventName)
expect { metrics?.count }.to(equal(count + 1))

Also maybe it would be better to verify if the summedEventName is in the metrics list?

@melekr melekr merged commit 0dbff43 into master Jul 9, 2024
4 checks passed
@melekr melekr deleted the bugfix/metrics-dispatcher-cicd branch July 9, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants