-
Notifications
You must be signed in to change notification settings - Fork 22
feat: introduce dagger for integration testing and ci #100
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # OpenFeature CLI Integration Testing | ||
|
|
||
| This directory contains integration tests for validating the OpenFeature CLI generators. | ||
|
|
||
| ## Integration Test Structure | ||
|
|
||
| The integration tests use [Dagger](https://dagger.io/) to create reproducible test environments without needing to install dependencies locally. | ||
|
|
||
| Each integration test: | ||
|
|
||
| 1. Builds the CLI from source | ||
| 2. Generates code using a sample manifest file | ||
| 3. Compiles and tests the generated code in a language-specific container | ||
| 4. Reports success or failure | ||
|
|
||
| ## Running Tests | ||
|
|
||
| ### Run all integration tests | ||
|
|
||
| ```bash | ||
| make test-integration | ||
| ``` | ||
|
|
||
| ### Run a specific integration test | ||
|
|
||
| ```bash | ||
| # For C# tests | ||
| make test-csharp-dagger | ||
| ``` | ||
|
|
||
| ## Adding a New Integration Test | ||
|
|
||
| To add an integration test for a new generator: | ||
|
|
||
| 1. Create a combined implementation and runner file in `test/integration/cmd/<language>/run.go` | ||
| 2. Update the main runner in `test/integration/cmd/run.go` to execute your new test | ||
| 3. Add a Makefile target for running your test individually | ||
|
|
||
| See the step-by-step guide in [new-language.md](new-language.md) for detailed instructions. | ||
|
|
||
| ## How It Works | ||
|
|
||
| The testing framework uses the following components: | ||
|
|
||
| - `test/integration/integration.go`: Defines the `Test` interface and common utilities | ||
| - `test/integration/cmd/run.go`: Runner for all integration tests that executes each language-specific test | ||
| - `test/integration/cmd/<language>/run.go`: Combined implementation and runner for each language | ||
| - `test/<language>-integration/`: Contains language-specific test files (code samples, project files) | ||
|
|
||
| Each integration test uses Dagger to: | ||
|
|
||
| 1. Build the CLI in a clean environment | ||
| 2. Generate code using a sample manifest | ||
| 3. Compile and test the generated code in a language-specific container | ||
| 4. Report success or failure | ||
|
|
||
| ## Benefits Over Shell Scripts | ||
|
|
||
| Using Dagger for integration tests provides several advantages: | ||
|
|
||
| 1. **Reproducibility**: Tests run in containerized environments that are identical locally and in CI | ||
| 2. **Language Support**: Easy to add new language tests with the same pattern | ||
| 3. **Improved Debugging**: Clear separation of build, generate, and test steps | ||
| 4. **Parallelization**: Tests can run in parallel when executed in different containers | ||
| 5. **No Dependencies**: No need to install language-specific tooling locally |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # C# Integration Testing | ||
|
|
||
| This directory contains integration tests for the C# code generator. | ||
|
|
||
| ## Running the tests | ||
|
|
||
| Run the C# integration tests with Dagger: | ||
|
|
||
| ```bash | ||
| make test-csharp-dagger | ||
| ``` | ||
|
|
||
| This will: | ||
| 1. Build the OpenFeature CLI | ||
| 2. Generate C# client code using the sample manifest | ||
| 3. Run the C# compilation test in an isolated environment | ||
| 4. Report success or failure | ||
|
|
||
| ## What the test does | ||
|
|
||
| The integration test: | ||
| 1. Builds the OpenFeature CLI inside a container | ||
| 2. Generates C# client code using a sample manifest | ||
| 3. Compiles the generated code with a sample program | ||
| 4. Runs the compiled program to verify it works correctly | ||
|
|
||
| ## Test Files | ||
|
|
||
| - `CompileTest.csproj`: .NET project file for compilation testing | ||
| - `Program.cs`: Test program that uses the generated code | ||
| - `expected/`: Directory containing expected output files (used for verification) | ||
|
|
||
| ## Implementation | ||
|
|
||
| The C# integration test uses Dagger to create a reproducible test environment: | ||
|
|
||
| 1. It builds the CLI in a Go container | ||
| 2. Generates C# code using the CLI | ||
| 3. Tests the generated code in a .NET container | ||
|
|
||
| The implementation is located in `test/integration/cmd/csharp/run.go`. | ||
|
|
||
| For more implementation details, see the main [test/README.md](../README.md) file. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.