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

Create E2E test suite and consolidate tests #149

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

jessepeterson
Copy link
Member

Create a new E2E test suite. This supersedes the previous storage tests. However, importantly, most of this new test suite utilizes the actual HTTP handlers for more of an end-to-end test. This brought about a number of specific wins:

  • We now test Bootstrap Tokens against all backends (was only the MySQL backend previously).
    • Fixed bugs in the file and PgSQL backends because of the tests!
  • We have a unified device "emulation" (previously implemented per-backend).
  • Consolidated shared test code into shared test package.
  • As mentioned also testing the actual HTTP handlers (the "end-to-end" goal).
    • This includes testing the handlers, the service layer, and the storage backends.
    • This includes testing an API HTTP handler for e.g. enqueuing commands.
  • Standardize on envvar-based test init for PgSQL backend (parity with MySQL backend)
  • The protocol test package comes from newly refactored code in mdmb. Perhaps one day we can share more code.
  • Along the way we also improved some handler creation protections with required arguments and/or better error handling.
  • New test for token update tally accounting (which is tested across all backends).

@jessepeterson
Copy link
Member Author

Fantastic. Caught another potential bug:

=== RUN   TestMySQL/e2e/bstoken
    bstoken.go:29: token for supposedly new device 66ADE930-5FDF-5EC4-8429-15640684C489 was not nil

@jessepeterson
Copy link
Member Author

jessepeterson commented Oct 16, 2024

This is a good start. To avoid making perfect the enemy of progress here are some notes for improvements so this can merged:

  • Test rigging/framework:
    • Merge device and enrollment packages. Main split right now is to support typed commands vs. raw streams.
    • Queue tests: maybe allow for specifying storage variations (for testing specific storage options?). This is in contrast to running the entire suite over a differently configured storage.
  • Actual tests/things tested:
    • Push: Add tests for push systems. Probably requires mocking APNs.
    • Migrate certauth service tests. Probably needs work to allow misconfigured enrollments (i.e. changing out device identity certs to attempt to spoof). This may be low-level enough that it might want to be its own test package. migrate certauth tests to e2e #150
    • User channel tests (incl. UserAuthenticate/directory users).
    • Migration endpoint tests.

@jessepeterson jessepeterson merged commit eadbc56 into micromdm:main Oct 16, 2024
9 checks passed
@jessepeterson jessepeterson deleted the test-e2e branch October 21, 2024 21:58
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.

1 participant