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

Added unit tests for secret_store module #206

Merged
merged 6 commits into from
Oct 9, 2024

Conversation

italo-sampaio
Copy link
Collaborator

  • Added unit tests for secret_store
  • Added mock implementations for the ocalls and seal API
  • Added trivial definitions of some open enclave types needed by the secret_store module
  • Some minor changes to secret_module.c to allow for full test coverage

- Removed unneeded include
- Removed redundant check for blob_size
- Added unit tests for secret_store
- Added mock implementations for the ocalls and seal API
- Added trivial definitions of some open enclave types needed by the secret_store module
Copy link
Collaborator

@amendelzon amendelzon left a comment

Choose a reason for hiding this comment

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

Looking fairly good. Left some comments that I think would be reasonable to address before adding more tests and potentially generating more inconsistencies.

firmware/src/hal/sgx/test/mock/mock_ocall.c Outdated Show resolved Hide resolved
firmware/src/hal/sgx/test/mock/mock_ocall.c Outdated Show resolved Hide resolved
firmware/src/hal/sgx/test/mock/mock_seal.c Outdated Show resolved Hide resolved
firmware/src/hal/sgx/test/mock/mock_seal.c Outdated Show resolved Hide resolved
firmware/src/hal/sgx/test/mock/hsm_t.h Show resolved Hide resolved
firmware/src/hal/sgx/test/secret_store/test_secret_store.c Outdated Show resolved Hide resolved
- Mock functions are now prefixed with `mock_` to follow the general pattern used for other HAL tests

- Mock implementation of functions needed by the tested unit are now part of the test suite, and just call the corresponding mock functions
- mocks no longer depend on specific definitions from secret_store
- now asserting that the expected values are written to the kvstore
- read/remove/exist tests now just write data interact directly to the kvstore and only test the read/remove/exist logic
@italo-sampaio
Copy link
Collaborator Author

@amendelzon Thanks for the suggestions. I pushed some commits addressing all of them, let me know if it looks good now.

Copy link
Collaborator

@amendelzon amendelzon left a comment

Choose a reason for hiding this comment

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

LGTM

@italo-sampaio italo-sampaio merged commit 599257a into feature/sgx-mvp Oct 9, 2024
5 checks passed
@italo-sampaio italo-sampaio deleted the enhancement/sest-unit-tests branch October 9, 2024 17:59
amendelzon pushed a commit that referenced this pull request Oct 22, 2024
- Added secret store unit tests
- Minor changes to secret_store.c to allow for easier unit testing
- Removed mock files from test coverage report
amendelzon pushed a commit that referenced this pull request Oct 22, 2024
- Added secret store unit tests
- Minor changes to secret_store.c to allow for easier unit testing
- Removed mock files from test coverage report
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.

2 participants