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

test(test-tooling): add container image builder utilities #3418

Conversation

petermetz
Copy link
Contributor

  1. Currently our integration tests depend on pre-published container
    images to be on the official registry (ghcr.io). This has pros and cons.
    The pro is that we can pin the tests to a specific ledger version and
    then have confidence that the test code works with that specific image.
    On the other hand if the image itself has problems we won't know it until
    after it was published and then tests were executed with it (unless we
    perform manual testing which is a lot of effrot as it requires the
    manual modification of the test cases).
  2. In order to gives us the ability to test against the container image
    definitions as they are in the current revision of the source code,
    we are adding here a couple of utility functions to streamline writing
    test cases that build the container images for themselves as part of the
    test case.

An example of how to use it in a test case:

const imgConnectorJvm = await buildImageConnectorCordaServer({
    logLevel,
});

// ...

connector = new CordaConnectorContainer({
    logLevel,
    imageName: imgConnectorJvm.imageName,
    imageVersion: imgConnectorJvm.imageVersion,
    envVars: [envVarSpringAppJson],
});

Signed-off-by: Peter Somogyvari [email protected]

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

Copy link
Contributor

@jagpreetsinghsasan jagpreetsinghsasan left a comment

Choose a reason for hiding this comment

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

LGTM.
This was a much needed feature! I will inform the team about the same

Copy link
Contributor

@outSH outSH left a comment

Choose a reason for hiding this comment

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

This is great, LGTM, thank you!

1. Currently our integration tests depend on pre-published container
images to be on the official registry (ghcr.io). This has pros and cons.
The pro is that we can pin the tests to a specific ledger version and
then have confidence that the test code works with that specific image.
On the other hand if the image itself has problems we won't know it until
after it was published and then tests were executed with it (unless we
perform manual testing which is a lot of effrot as it requires the
manual modification of the test cases).
2. In order to gives us the ability to test against the container image
definitions as they are in the current revision of the source code,
we are adding here a couple of utility functions to streamline writing
test cases that build the container images for themselves as part of the
test case.

An example of how to use it in a test case:

```typescript
const imgConnectorJvm = await buildImageConnectorCordaServer({
    logLevel,
});

// ...

connector = new CordaConnectorContainer({
    logLevel,
    imageName: imgConnectorJvm.imageName,
    imageVersion: imgConnectorJvm.imageVersion,
    envVars: [envVarSpringAppJson],
});

```

Signed-off-by: Peter Somogyvari <[email protected]>
@petermetz petermetz force-pushed the test-test-tooling-image-building-utilities branch from 38903d5 to 5528e29 Compare July 17, 2024 21:12
@petermetz petermetz disabled auto-merge July 17, 2024 21:12
@petermetz petermetz merged commit 497ea32 into hyperledger-cacti:main Jul 18, 2024
139 of 143 checks passed
@petermetz petermetz deleted the test-test-tooling-image-building-utilities branch July 18, 2024 00:31
@petermetz
Copy link
Contributor Author

This is great, LGTM, thank you!

@outSH Thank you! For now I only have the ready-made utility functions for the corda images, but we can add more, ideally all images would be possible to be built by the tests like this in the future.

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.

3 participants