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

Fix android crash on startup #1954

Merged
merged 4 commits into from
Mar 31, 2020
Merged

Fix android crash on startup #1954

merged 4 commits into from
Mar 31, 2020

Conversation

anjmao
Copy link
Contributor

@anjmao anjmao commented Mar 30, 2020

  1. Fix for Android app crash with nil pointer dereference in AccountantPromiseSettler #1952
  2. Add e2e test for mobile entry point.
  3. Remove di_mobile.go and use flag to determine if specific logic is needed when consumer is mobile.

@anjmao anjmao force-pushed the mobile-e2e branch 3 times, most recently from 22d1e5b to 5d94708 Compare March 30, 2020 15:37
@anjmao anjmao changed the title Add mobile e2e test Fix android crash on startup Mar 30, 2020
@anjmao anjmao force-pushed the mobile-e2e branch 3 times, most recently from 33ffcf7 to b5ad87b Compare March 30, 2020 17:57
cmd/di.go Outdated Show resolved Hide resolved
@@ -62,6 +61,10 @@ import (

// bootstrapServices loads all the components required for running services
func (di *Dependencies) bootstrapServices(nodeOptions node.Options, servicesOptions config.ServicesOptions) error {
if nodeOptions.MobileConsumer {
Copy link
Member

Choose a reason for hiding this comment

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

What was wrong with build flags approach?
Because now file is di_desktop.go but full of conditional logic, which would be nice to avoid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. I can't build mobile entry point using go build ./mobile/mysterium since di_mobile will not be included but di_mobile doesn't contain any OS specific logic.
  2. There are multiple checks already with feature flags, example https://github.com/mysteriumnetwork/node/blob/master/cmd/di_desktop.go#L342.
  3. I can't write e2e test properly. If I add GOOS=android it will require specific C++, but for now I just want to write e2e test which tests that mobile entry point doesn't crash on startup, so if connect is not working at least use can sent feedback.

Copy link
Contributor

Choose a reason for hiding this comment

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

I too am for conditional compiling, if possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @Waldz here. We should not increase our codebase with platform checks inside if we can build accordingly.

Copy link
Contributor Author

@anjmao anjmao Mar 31, 2020

Choose a reason for hiding this comment

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

80% of current mobile entrypoint API can be tested without any android specific build tag and most importantly it tests for possible crashes when some dependencies are not added to mobile . If you still want conditional compiling I can close this PR and add a separate task since it will require 3-4 days at least to make it work. @zolia

Copy link
Member

Choose a reason for hiding this comment

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

So it's just for the test, but not released artefact, ASFAIK.
Is there a way to force a android tag in this test particularly. Maybe adding custom flag like "e2e" is what you need?

Copy link
Contributor

@zolia zolia left a comment

Choose a reason for hiding this comment

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

nice work

@anjmao
Copy link
Contributor Author

anjmao commented Mar 31, 2020

@Waldz @zolia @vkuznecovas I merge it as is for now. If you have ideas how to add android with build tags to our e2e tests fast and cheap without waisting time let me know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants