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

Simulation framework for multi-client server testing #358

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

sekulicd
Copy link
Collaborator

This introduces a simulation framework designed to test the server by simulating multiple clients performing various actions over several rounds. The framework reads simulation configurations from YAML files, validates them against a predefined schema, and executes the simulation accordingly.

simulation1.yaml is configured as per this requirement, but this was created with idea that any scenario can be configured.

@tiero @altafan @louisinger @bordalix please review.

This PR introduces a simulation framework designed to test the server by simulating multiple clients performing various
actions over several rounds. The framework reads simulation configurations from YAML files, validates them against a
predefined schema, and executes the simulation accordingly.

Here's a summary of the key changes made:

1. **New `simulation` Module**:
   - Added a new Go module `simulation` with its own `go.mod` and `go.sum`.
   - Introduced a main application for running simulations based on a YAML configuration.
   - Included functions for setting up clients, performing actions like onboarding, sending transactions, and claiming funds.
   - Added validation of simulation configuration against a schema using `gojsonschema`.

2. **Simulation Configuration**:
   - Added `simulation1.yaml` as an example configuration file for running simulations.
   - Defined a `schema.yaml` for validating simulation configurations.

3. **`.gitignore` Updates**:
   - Added `.idea` to ignore IntelliJ IDEA project files.

4. **`Dockerfile` Update**:
   - Updated the base image version of Golang from `1.23.1` to `1.23.2`.

5. **`go.work` Update**:
   - Updated the Go version from `1.23.1` to `1.23.2`.
   - Added a new directory `./simulation` to the workspace.

6. **`go.work.sum` Update**:
   - Added new dependencies `github.com/coreos/go-systemd` and `github.com/go-task/slim-sprig`.

7. **`e2e_test.go` Modifications**:
   - Removed the `setupAspWallet` function and replaced its usage with `utils.SetupAspWalletCovenantless`.

8. **`test_utils.go` Modifications**:
   - Added a new function `SetupAspWalletCovenantless` to handle wallet setup with optional initial funding.
Copy link
Member

@tiero tiero left a comment

Choose a reason for hiding this comment

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

I would not bump version in this PR, best to make one to go in master in a dedicated commit before this if is needed. Want to square out potential bugs/replication issues coming from different go versions.

Also please add a README documentation on how to run the simulation

simulation/main.go Show resolved Hide resolved
simulation/schema.yaml Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
@sekulicd
Copy link
Collaborator Author

I would not bump version in this PR

Reverted

simulation/README.md Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
- number: int(min=1)
actions:
regex('^client_\d+$'):
- type: enum('Onboard', 'SendAsync', 'SendOffchain', 'SendOnchain', 'Claim', 'CollaborativeExit', 'UnilateralExit')
Copy link
Collaborator

Choose a reason for hiding this comment

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

In order to maintain coherence with method's names, I think "CollaborativeExit" should be renamed to "CollaborativeRedeem"

Suggested change
- type: enum('Onboard', 'SendAsync', 'SendOffchain', 'SendOnchain', 'Claim', 'CollaborativeExit', 'UnilateralExit')
- type: enum('Onboard', 'SendAsync', 'SendOffchain', 'SendOnchain', 'Claim', 'CollaborativeRedeem', 'UnilateralExit')

Copy link
Member

Choose a reason for hiding this comment

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

but redeem can be confused with Redeem Tx for oor?

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.

4 participants