-
Notifications
You must be signed in to change notification settings - Fork 97
Change load testing to use the websocket implementation #6640
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
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces several modifications across multiple GitHub Actions workflows. Key changes include updating input parameters for load testing, altering job dependencies, and refining conditions for deployment triggers. Specifically, the default value for the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (2)
.github/workflows/load-tests.yaml (1)
Line range hint
149-157
: Consider enhancing error handling and test status monitoringInstead of using fixed sleep durations for test bootstrap and completion, consider implementing a more robust solution:
- Poll the k6 operator status to confirm test bootstrap
- Monitor the test execution status instead of sleeping
- Add timeout and failure handling
This would make the workflow more reliable and provide better feedback on test progress.
Would you like me to provide an example implementation of these improvements?
.github/workflows/merge.yaml (1)
84-89
: LGTM! Consider documenting the new load testing parameters.The changes to load testing parameters align well with the websocket implementation:
cluster_nodes: core
for core node testingtopology: many2many
for multiple concurrent connectionsworkload: constant
for sustained loadvu
parameter for virtual user simulationConsider adding documentation about these new parameters and their expected values in the repository's testing documentation.
🧰 Tools
🪛 actionlint
87-87: input "duration" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
88-88: input "vu" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
89-89: input "rate" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
.github/workflows/build-dappnode.yaml
(2 hunks).github/workflows/load-tests.yaml
(6 hunks).github/workflows/merge.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/merge.yaml
87-87: input "duration" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
88-88: input "vu" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
89-89: input "rate" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
🔇 Additional comments (4)
.github/workflows/load-tests.yaml (2)
45-53
: LGTM! Well-structured topology configuration.
The new topology
input with predefined options (many2many
, sender
, relayer
, receiver
) provides good structure to the test configuration.
13-16
: LGTM! The renaming from nodes
to cluster_nodes
improves clarity.
The parameter name change better describes its purpose and the available options are well-defined.
Let's verify this rename doesn't break other workflows:
Also applies to: 37-44
✅ Verification successful
The parameter rename is correctly reflected in all workflow files
The search results confirm that:
- The new parameter name
cluster_nodes
is used consistently inload-tests.yaml
- The calling workflow
merge.yaml
uses the correct parameter namecluster_nodes
- No instances of the old parameter name
nodes
were found
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining usage of the old parameter name
rg "nodes:" .github/workflows/ -A 5 -B 5
Length of output: 1894
.github/workflows/build-dappnode.yaml (2)
109-110
: LGTM! Improved version handling for non-standard branches
The change to use commit hash for version naming on non-standard branches is a good improvement:
- Prevents workflow failures
- Provides better traceability with commit reference
- Maintains unique versioning for all builds
28-28
: Verify the impact of changing default network to testnet
Changing the default network from mainnet (dufour) to testnet (rotsee) is a significant change that could affect production deployments. While this change aligns with best practices by defaulting to testnet, we should ensure there are sufficient safeguards in place.
Let's verify the usage of this workflow:
Consider adding a warning step in the workflow when building for mainnet to prevent accidental mainnet deployments.
✅ Verification successful
Default network change to testnet is safe and well-implemented
After analyzing the workflow file, the change is safe because:
- For manual triggers (
workflow_dispatch
), the network is always required and explicitly chosen via UI dropdown - For automated triggers (
workflow_call
), the network is determined by the repository name pattern, not the default value - The workflow has proper safeguards:
- Different package repositories for testnet/mainnet (
DAppNodePackage-Hopr-testnet
vsDAppNodePackage-Hopr
) - Proper version tagging that differentiates between environments
- Concurrency controls to prevent conflicts
- Different package repositories for testnet/mainnet (
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for direct references to this workflow and its network parameter
# to ensure all callers explicitly specify the network when needed
# Search for workflow references
echo "Checking for workflow references:"
rg -A 5 "uses: .*build-dappnode\.yaml"
# Search for manual workflow dispatch events in the UI
echo "Checking for workflow_dispatch events:"
rg "workflow_dispatch.*build-dappnode"
Length of output: 245
Script:
#!/bin/bash
# Let's check the workflow file itself to understand how the network parameter is used
# and what safeguards might already be in place
# Check the workflow file content
echo "Checking workflow file content:"
cat .github/workflows/build-dappnode.yaml
# Also check for any other workflow files that might be related
echo -e "\nChecking other workflow files:"
fd -e yaml -e yml . .github/workflows/
Length of output: 6585
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
.github/workflows/build-dappnode.yaml
(2 hunks).github/workflows/load-tests.yaml
(6 hunks).github/workflows/merge.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/merge.yaml
87-87: input "duration" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
88-88: input "vu" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
89-89: input "rate" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
🔇 Additional comments (8)
.github/workflows/load-tests.yaml (4)
97-101
: Well-structured environment variable naming
The new K6_ prefixed environment variables provide better clarity and standardization with the k6 testing tool. The names are self-descriptive and clearly indicate their purpose.
Also applies to: 108-113
Line range hint 160-165
: Improved results collection step naming
The rename from "Parse results" to "Collect Load test results" better reflects the step's purpose.
Line range hint 153-157
: Review websocket connection bootstrap timing
The current configuration uses fixed delays:
- 2 minutes for bootstrap
- Test duration from input
For websocket implementations, connection establishment might need different timing considerations. Consider making the bootstrap wait time configurable based on the number of nodes and topology.
Let's check the setup scripts for connection handling:
#!/bin/bash
# Search for connection setup and wait logic
rg -A 10 "connection.*setup|bootstrap" ./k6
75-78
: Verify the default rate for websocket implementation
The default rate of 50 messages per second per virtual user per route seems high for websocket connections. This could potentially overwhelm the system or create connection bottlenecks.
Let's check the historical performance data:
.github/workflows/build-dappnode.yaml (3)
109-110
: LGTM: Improved version tracking for non-standard branches
The addition of commit hash to version strings for non-standard branches is a good improvement that:
- Enhances traceability of builds
- Provides unique identifiers for debugging
- Maintains existing behavior for master/release branches
Line range hint 1-143
: Verify alignment with websocket implementation changes
While the changes in this file appear to be improvements, they seem tangential to the PR's main objective of implementing websocket-based load testing. Please clarify:
- Why the default network needed to change
- How these changes support the websocket implementation
Let's check for websocket-related changes in other files:
#!/bin/bash
# Look for websocket-related changes in other workflow files
rg -A 5 "websocket" .github/workflows/
# Check for any load test configuration files that might have been modified
fd -g "*load-test*.{yaml,json}" | xargs cat
28-28
: Verify the impact of changing default network to testnet
The default network has been changed from 'dufour' (mainnet) to 'rotsee' (testnet). While this might be safer as a default, it represents a significant change in behavior that could affect production deployments.
Let's verify if this change is intentional and aligned with the websocket implementation changes:
✅ Verification successful
Based on the gathered information, I can now provide a final response regarding the change of default network from 'dufour' to 'rotsee':
Change of default network is aligned with websocket implementation changes
The change from 'dufour' to 'rotsee' as the default network in the build workflow is intentional and correct. The evidence shows:
- Both networks are defined in releases.json with version_range "2.*"
- The change aligns with the PR's websocket implementation as 'rotsee' is the staging network for testing new features
- The tests.yaml shows dedicated websocket test configurations, indicating this is part of a coordinated websocket testing effort
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any other workflow files that might be affected by this network change
rg -l "network.*dufour" .github/workflows/
# Check for any documentation that might need updating
fd -g "*.md" | xargs rg "dufour.*default"
Length of output: 3171
Script:
#!/bin/bash
# Let's check for any references to network configurations and their defaults
rg -A 3 "network.*default" .
# Also check for any references to 'rotsee' to understand the context
rg -A 3 "rotsee" .
# Check for any configuration files that might define networks
fd -g "*config*.{yaml,json,ts,js}" | xargs cat
Length of output: 259967
.github/workflows/merge.yaml (1)
84-89
: LGTM! Verify environment variables are configured.
The load testing configuration changes look good and align with the websocket implementation update. The parameter names are more descriptive and the testing pattern is clearly defined.
Let's verify the required environment variables are configured:
🧰 Tools
🪛 actionlint
87-87: input "duration" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
88-88: input "vu" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
89-89: input "rate" is typed as number by reusable workflow "./.github/workflows/load-tests.yaml". string value cannot be assigned
(expression)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
.github/workflows/build-dappnode.yaml (1)
109-110
: LGTM! Consider standardizing commit hash lengthGood improvement to version handling for non-standard branches. Using the commit hash provides better traceability and allows for unique versioning of development builds.
Consider using a fixed length for the commit hash (e.g.,
--short=8
) to ensure consistent version string lengths:-last_commit=$(git rev-parse --short HEAD) +last_commit=$(git rev-parse --short=8 HEAD)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/build-dappnode.yaml
(3 hunks)
🔇 Additional comments (2)
.github/workflows/build-dappnode.yaml (2)
28-28
: Verify the intentional change of default network to testnet
The default network has been changed from mainnet (dufour) to testnet (rotsee). While this is a good practice for testing the new websocket implementation, please confirm this is intentional as it affects manual workflow triggers.
135-135
: LGTM! Good defensive programming
The added condition prevents workflow failures by ensuring comments are only created in the context of pull requests.
…net/hoprnet into ausias/websocket-load-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (5)
.github/workflows/load-tests.yaml (5)
Line range hint
13-30
: Add default values to workflow_call inputsThe workflow_call inputs lack default values that are present in workflow_dispatch. This inconsistency could cause issues when the workflow is called programmatically.
Add default values to match workflow_dispatch:
rate: type: number required: true + default: 50 vu: type: number required: true + default: 1
45-53
: Document topology options with descriptionsThe topology choices would benefit from descriptions explaining their purpose and impact on the test setup.
Add descriptions like:
topology: type: choice options: - many2many # Tests message passing between all nodes - sender # Tests dedicated sender nodes - relayer # Tests intermediate relay nodes - receiver # Tests dedicated receiver nodes required: true - description: 'Nodes channel topology' + description: 'Node channel topology (many2many: all-to-all communication, sender: dedicated senders, relayer: intermediate nodes, receiver: dedicated receivers)'
96-114
: Reduce duplication in environment variable setupThe environment variable setup is duplicated between manual and programmatic triggers. This could be simplified to reduce maintenance overhead.
Consider refactoring to:
- name: Set environment variables id: vars run: | + # Determine input source based on trigger type + input_source="${{ github.event.inputs.test_id }}" && source="github.event.inputs" || source="inputs" + { - if [ -z "${{ github.event.inputs.test_id }}" ]; then - echo "The workflow is triggered by other pipeline" - { - echo "TESTID=${{ inputs.test_id }}" - echo "K6_CLUSTER_NODES=${{ inputs.cluster_nodes }}" - echo "K6_TOPOLOGY_NAME=${{ inputs.topology }}" - echo "K6_WORKLOAD_NAME=${{ inputs.workload }}" - echo "K6_TEST_DURATION=${{ inputs.duration }}" - echo "K6_VU_PER_ROUTE=${{ inputs.vu }}" - echo "K6_REQUESTS_PER_SECOND_PER_VU=${{inputs.rate }}" - } >> $GITHUB_ENV - else - echo "The workflow is triggered manually" - { - echo "TESTID=${{ github.event.inputs.test_id }}" - echo "K6_CLUSTER_NODES=${{ github.event.inputs.cluster_nodes }}" - echo "K6_TOPOLOGY_NAME=${{ github.event.inputs.topology }}" - echo "K6_WORKLOAD_NAME=${{ github.event.inputs.workload }}" - echo "K6_TEST_DURATION=${{ github.event.inputs.duration }}" - echo "K6_VU_PER_ROUTE=${{ github.event.inputs.vu }}" - echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ github.event.inputs.rate }}" - } >> $GITHUB_ENV - fi + echo "TESTID=${{ ${source}.test_id }}" + echo "K6_CLUSTER_NODES=${{ ${source}.cluster_nodes }}" + echo "K6_TOPOLOGY_NAME=${{ ${source}.topology }}" + echo "K6_WORKLOAD_NAME=${{ ${source}.workload }}" + echo "K6_TEST_DURATION=${{ ${source}.duration }}" + echo "K6_VU_PER_ROUTE=${{ ${source}.vu }}" + echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ ${source}.rate }}" } >> $GITHUB_ENV
Line range hint
153-157
: Replace fixed sleep with dynamic test completion checkUsing fixed sleep durations is fragile and could lead to premature termination or unnecessary waiting.
Consider implementing a loop that checks for test completion:
- echo "Waiting for test to bootstrap..." - sleep 2m # Wait for test to bootstrap - echo "Waiting for test to finish..." - sleep ${{ steps.vars.outputs.DURATION }}m # wait for the test to finish + echo "Waiting for test to bootstrap..." + kubectl wait --for=condition=initialized k6 k6-test --timeout=5m + echo "Waiting for test to finish..." + kubectl wait --for=condition=complete k6 k6-test --timeout=$(( ${{ steps.vars.outputs.DURATION }} + 5 ))m
Line range hint
160-165
: Add error handling for test results collectionThe results collection step should validate the test's success and handle potential failures.
Add error handling:
- name: Collect Load test results run: | + # Check if test completed successfully + if ! kubectl get k6 k6-test -o json | jq -e '.status.stage == "finished"' > /dev/null; then + echo "::error::Load test failed or did not complete properly" + exit 1 + fi kubectl delete -f k6-test-results.yaml 2> /dev/null || true kubectl apply -f k6-test-results.yaml + # Verify results were collected + if ! kubectl wait --for=condition=complete k6-test-results --timeout=2m; then + echo "::error::Failed to collect test results" + exit 1 + fi
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
The latest dAppNode package for DAppNodePackage-Hopr-testnet has been built and uploaded with IPFS hash: /ipfs/QmbPRpoD3MPYrFW1EppDA55XpwWG4C8LqAuovdF6mxsn2o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
.github/workflows/build.yaml (1)
42-42
: Remove trailing whitespace.There's a trailing whitespace at the end of line 42.
- needs: + needs:🧰 Tools
🪛 yamllint
[error] 42-42: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/build.yaml
(1 hunks)
🧰 Additional context used
🪛 yamllint
.github/workflows/build.yaml
[error] 42-42: trailing spaces
(trailing-spaces)
🔇 Additional comments (2)
.github/workflows/build.yaml (2)
42-43
: LGTM! Good job ensuring proper build sequencing.
The addition of the dependency ensures that the Docker images are built before the DAppNode packages, which is the correct order of operations.
Let's verify the dependency chain and related workflows:
✅ Verification successful
The job dependency is correctly configured and necessary
The dependency between build-dappnode
and build-docker
jobs is essential because:
- The DAppNode packages require Docker images to be built first
- This is verified by the merge workflow which follows the same pattern for releases
- Other dependent jobs like
load_test
,create_release
, anddocs
also depend onbuild-docker
completion
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the workflow dependencies and related changes
# Check for any other workflow files that might need similar dependencies
# Look for other workflow files that might reference build-docker or build-dappnode
rg -l "build-docker|build-dappnode" .github/workflows/
Length of output: 3132
Script:
#!/bin/bash
# Let's verify the build.yaml workflow to understand the complete job dependency chain
rg -A 10 "jobs:" .github/workflows/build.yaml
# Also check if build-docker job exists and its dependencies
rg -A 15 "build-docker:" .github/workflows/build.yaml
# Check if there are any other jobs that might need to depend on build-docker
rg "needs.*build-docker" .github/workflows/
Length of output: 752
Script:
#!/bin/bash
# Let's check the build-dappnode job configuration and its relationship with Docker builds
rg -A 10 "build-dappnode:" .github/workflows/build.yaml
# Check if there are any reusable workflow files that might be relevant
fd 'build.*ya?ml' .github/workflows/
# Check the content of build-docker.yaml to understand the complete workflow
rg -l "build-docker.yaml" .github/workflows/ | xargs cat
Length of output: 13838
🧰 Tools
🪛 yamllint
[error] 42-42: trailing spaces
(trailing-spaces)
Line range hint 1-100
: Verify alignment with PR objectives.
The changes in this workflow file appear to be focused on build process dependencies, but the PR objectives mention changes to load testing with websocket implementation. While this change might be part of a larger set of changes, it would be good to verify how this relates to the websocket implementation changes.
Let's check for related changes in other workflow files:
🧰 Tools
🪛 yamllint
[error] 42-42: trailing spaces
(trailing-spaces)
The latest dAppNode package for DAppNodePackage-Hopr-testnet has been built and uploaded with IPFS hash: /ipfs/QmPTkGhvLW6crehbSeR3zrGawVdPBjz9LtPML8m8Er2Wxj |
The latest dAppNode package for DAppNodePackage-Hopr-testnet has been built and uploaded with IPFS hash: /ipfs/QmRUkjAjKGNF7KVnjqrL6Qe7mxLGMktrjYMP3iQCPr5Vma |
…net/hoprnet into ausias/websocket-load-tests
…net/hoprnet into ausias/websocket-load-tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (5)
.github/workflows/load-tests.yaml (5)
13-15
: Add descriptions to workflow_call inputsWhile workflow_dispatch inputs have helpful descriptions, the corresponding workflow_call inputs lack descriptions. Consider adding descriptions to improve maintainability.
Note: I see from the learnings that the
enum
property isn't supported in workflow_call, so the different validation approaches are expected.Also applies to: 37-44
26-30
: Add default values to workflow_call inputsThe workflow_dispatch inputs have default values for
vu
(1) andrate
(50), but these defaults are missing in the workflow_call inputs. Consider adding default values to ensure consistent behavior.Also applies to: 69-78
96-103
: Consider extracting common environment variables to a functionThe environment variable setup is duplicated between the manual and pipeline triggers. Consider extracting this to a shell function to reduce duplication and improve maintainability.
- name: Set environment variables id: vars run: | + setup_env_vars() { + local prefix=$1 + { + echo "TESTID=$prefix${{ github.event.inputs.test_id }}" + echo "K6_CLUSTER_NODES=$prefix${{ github.event.inputs.cluster_nodes }}" + echo "K6_TOPOLOGY_NAME=$prefix${{ github.event.inputs.topology }}" + echo "K6_WORKLOAD_NAME=$prefix${{ github.event.inputs.workload }}" + echo "K6_TEST_DURATION=$prefix${{ github.event.inputs.duration }}" + echo "K6_VU_PER_ROUTE=$prefix${{ github.event.inputs.vu }}" + echo "K6_REQUESTS_PER_SECOND_PER_VU=$prefix${{ github.event.inputs.rate }}" + } >> $GITHUB_ENV + } + if [ -z "${{ github.event.inputs.test_id }}" ]; then echo "The workflow is triggered by other pipeline" - { - echo "TESTID=${{ inputs.test_id }}" - echo "K6_CLUSTER_NODES=${{ inputs.cluster_nodes }}" - echo "K6_TOPOLOGY_NAME=${{ inputs.topology }}" - echo "K6_WORKLOAD_NAME=${{ inputs.workload }}" - echo "K6_TEST_DURATION=${{ inputs.duration }}" - echo "K6_VU_PER_ROUTE=${{ inputs.vu }}" - echo "K6_REQUESTS_PER_SECOND_PER_VU=${{inputs.rate }}" - } >> $GITHUB_ENV + setup_env_vars "\${{ inputs." else echo "The workflow is triggered manually" - { - echo "TESTID=${{ github.event.inputs.test_id }}" - echo "K6_CLUSTER_NODES=${{ github.event.inputs.cluster_nodes }}" - echo "K6_TOPOLOGY_NAME=${{ github.event.inputs.topology }}" - echo "K6_WORKLOAD_NAME=${{ github.event.inputs.workload }}" - echo "K6_TEST_DURATION=${{ github.event.inputs.duration }}" - echo "K6_VU_PER_ROUTE=${{ github.event.inputs.vu }}" - echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ github.event.inputs.rate }}" - } >> $GITHUB_ENV + setup_env_vars "\${{ github.event.inputs." fiAlso applies to: 107-114
Line range hint
153-157
: Replace fixed sleep with dynamic waitUsing a fixed sleep duration (2m) for test bootstrap might be unreliable. Consider implementing a polling mechanism to check the test status.
- echo "Waiting for test to bootstrap..." - sleep 2m # Wait for test to bootstrap + echo "Waiting for test to bootstrap..." + kubectl wait --for=condition=ready k6 k6-test --timeout=5m echo "Waiting for test to finish..." sleep ${{ steps.vars.outputs.DURATION }}m # wait for the test to finish
Line range hint
160-165
: Add error handling for kubectl operationsThe kubectl operations lack proper error handling and status checks. Consider adding validation to ensure the operations completed successfully.
- name: Collect Load test results run: | kubectl delete -f k6-test-results.yaml 2> /dev/null || true kubectl apply -f k6-test-results.yaml + if ! kubectl wait --for=condition=complete k6 k6-test-results --timeout=2m; then + echo "Failed to collect test results" + exit 1 + fi
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
.github/workflows/load-tests.yaml (1)
102-102
: Fix spacing in variable referenceThere's inconsistent spacing in the variable reference.
- echo "K6_REQUESTS_PER_SECOND_PER_VU=${{inputs.rate }}" + echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ inputs.rate }}"
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
🪛 actionlint (1.7.3)
.github/workflows/load-tests.yaml
145-145: shellcheck reported issue in this script: SC2086:info:2:15: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (2)
.github/workflows/load-tests.yaml (2)
Line range hint 13-30
: LGTM: Input parameters structure is well-defined
The new input parameters and type changes align well with the websocket implementation requirements. The parameter types are appropriate for their intended use.
Line range hint 37-79
: LGTM: Well-structured manual trigger configuration
The manual trigger configuration provides good user experience with:
- Clear descriptions for each parameter
- Appropriate default values
- Comprehensive set of options for topology and workload types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
.github/workflows/load-tests.yaml (2)
102-102
: Fix inconsistent spacing in environment variable assignmentThere's an extra space between
inputs.
andrate
that should be removed for consistency.- echo "K6_REQUESTS_PER_SECOND_PER_VU=${{inputs.rate }}" + echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ inputs.rate }}"
141-142
: Improve shell script safety with proper quotingThe shell script should use proper quoting to prevent word splitting and handle special characters in variable values.
- hoprdApiToken=$(kubectl get secret -n k6-operator-system -o json hoprd-api-tokens | jq --arg entry "${K6_CLUSTER_NODES}" -r '.data.${entry}' | base64 -d) - echo "HOPRD_API_TOKEN=${hoprdApiToken}" >> $GITHUB_ENV + hoprdApiToken=$(kubectl get secret -n k6-operator-system -o json hoprd-api-tokens | jq --arg entry "${K6_CLUSTER_NODES}" -r '.data[$entry]' | base64 -d) + echo "HOPRD_API_TOKEN=${hoprdApiToken}" >> "$GITHUB_ENV"
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
🪛 actionlint (1.7.3)
.github/workflows/load-tests.yaml
145-145: shellcheck reported issue in this script: SC2086:info:2:15: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (3)
.github/workflows/load-tests.yaml (3)
13-15
: LGTM! Input parameters are well-defined
The cluster_nodes
parameter is correctly defined with different types in workflow_call
(string) and workflow_dispatch
(choice) sections, as enum
is not supported in workflow_call
. The implementation aligns with GitHub Actions constraints.
Also applies to: 37-44
121-121
:
Remove hardcoded feature branch reference
The workflow is checking out a specific feature branch that should be changed to main
before merging.
- ref: ausias/weboscket-bidirectional # main
+ ref: main
Likely invalid or redundant comment.
147-147
: Verify test duration calculations
The workflow uses fixed sleep durations:
- 2 minutes for bootstrap
${K6_TEST_DURATION}
minutes for test execution
Please verify if these durations are sufficient for the websocket implementation, especially for larger topologies.
Also applies to: 157-157
✅ Verification successful
Based on the workflow file analysis, I can now generate the final response:
Sleep durations are appropriate for websocket implementation
The current sleep durations are well-configured for the websocket implementation:
- 2 minutes bootstrap time is sufficient for initial setup and connection establishment
- Test duration is parameterized via
K6_TEST_DURATION
and can be adjusted per topology needs - The sleep durations are properly synchronized with the actual test execution through environment variables
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if there are any timing-related issues reported in past test runs
# Search for timing-related issues in test results
kubectl logs -n k6-operator-system -l app=k6-operator --tail=1000 | grep -i "timeout\|duration\|exceeded"
# Check if any tests were terminated before completion
kubectl get k6 -n k6-operator-system -o json | jq '.items[] | select(.status.stage == "terminated") | {name: .metadata.name, stage: .status.stage, reason: .status.reason}'
Length of output: 477
Script:
#!/bin/bash
# Let's analyze the workflow file and related test configurations to understand timing settings
# Check the workflow file for timing-related configurations
rg -A 2 -B 2 "duration|sleep|timeout" .github/workflows/load-tests.yaml
# Look for test configuration files that might contain timing settings
fd -e json -e js -e yaml -e yml . | xargs rg -l "duration|timeout"
# Search for any timing-related constants or configurations in test setup files
fd setup | xargs rg -l "duration|timeout|sleep"
Length of output: 4224
Script:
#!/bin/bash
# Let's check the test configurations and k6 scripts to understand the actual test requirements
# Check k6 test scripts for timing configurations
fd -e js . k6/ | xargs rg -A 3 -B 3 "duration|sleep"
# Look for topology-specific setup scripts
fd setup k6/ | xargs cat
# Check k6 test configuration template
cat k6/k6-test-run.yaml
Length of output: 102351
Script:
#!/bin/bash
# Let's check the workflow file for test duration and sleep configurations
# Look for test duration and sleep configurations in the workflow file
rg -A 5 -B 5 "K6_TEST_DURATION|sleep" .github/workflows/load-tests.yaml
# Check for any topology-specific setup scripts that might affect timing
fd -e sh -e js -e yaml -e yml . | xargs rg -l "setup|bootstrap|duration|sleep"
Length of output: 6041
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
🪛 actionlint (1.7.3)
.github/workflows/load-tests.yaml
145-145: shellcheck reported issue in this script: SC2086:info:2:15: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (3)
.github/workflows/load-tests.yaml (3)
Line range hint 13-30
: LGTM! Input parameters are well-structured
The new input parameters and type changes are appropriate for the websocket implementation. The required flags ensure all necessary parameters are provided when the workflow is called.
Line range hint 37-79
: LGTM! Manual trigger parameters are well-documented
The input parameters for manual triggers are well-structured with clear descriptions and appropriate default values. The choice options effectively constrain inputs to valid values.
121-121
:
Remove hardcoded feature branch reference
The workflow is checking out a specific feature branch ausias/weboscket-bidirectional
instead of main
. This could cause issues if the branch is deleted or rebased.
Apply this fix:
- ref: ausias/weboscket-bidirectional # main
+ ref: main
Likely invalid or redundant comment.
The latest dAppNode package for DAppNodePackage-Hopr-testnet has been built and uploaded with IPFS hash: /ipfs/Qme5TmKrfDfFkASHDsYK7TH1faBvD83EdsFKmxeZ8jSEha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
.github/workflows/load-tests.yaml (1)
102-102
: Fix spacing in variable referenceThere's an extra space between
inputs
and the dot operator.- echo "K6_REQUESTS_PER_SECOND_PER_VU=${{inputs.rate }}" + echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ inputs.rate }}"
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
🪛 actionlint (1.7.3)
.github/workflows/load-tests.yaml
145-145: shellcheck reported issue in this script: SC2086:info:2:15: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (2)
.github/workflows/load-tests.yaml (2)
157-157
: LGTM! Test execution and results collection look good
The changes appropriately handle:
- Test duration using the environment variable
- Cleanup of previous test runs
- Collection of test results
Also applies to: 160-160
48-51
: Verify topology implementations
Please ensure that all listed topology options (many2many
, sender
, relayer
, receiver
) have corresponding implementations in the setup scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
🪛 actionlint (1.7.3)
.github/workflows/load-tests.yaml
145-145: shellcheck reported issue in this script: SC2086:info:2:15: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (3)
.github/workflows/load-tests.yaml (3)
Line range hint 13-30
: LGTM! Well-structured input parameters
The new input parameters are well-defined with appropriate types and requirements. The changes support the websocket implementation while maintaining type safety.
Line range hint 37-79
: LGTM! Well-documented manual trigger parameters
The manual trigger parameters are well-structured with clear descriptions and appropriate default values. The choice options for topology and cluster_nodes provide good guardrails for manual execution.
147-147
: 🛠️ Refactor suggestion
Add quotes around shell variables in setup command
The setup command should use proper quoting:
- npm run setup:${K6_TOPOLOGY_NAME}
+ npm run "setup:${K6_TOPOLOGY_NAME}"
Likely invalid or redundant comment.
The latest dAppNode package for DAppNodePackage-Hopr-testnet has been built and uploaded with IPFS hash: /ipfs/QmTGQFWmioDjUpdxM9TotfWbs8b1LSnWHTyqcxgJkeKSJG |
The latest dAppNode package for DAppNodePackage-Hopr-testnet has been built and uploaded with IPFS hash: /ipfs/QmR1jsTBdFbxn4v6352tgK6UqfwmrNZufX8LHuA2P8cAhV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
.github/workflows/load-tests.yaml (2)
95-114
: Consider reducing code duplication in environment variable setupThe current implementation duplicates the environment variable assignments between pipeline and manual triggers. Consider refactoring to reduce duplication.
- if [ -z "${{ github.event.inputs.test_id }}" ]; then - echo "The workflow is triggered by other pipeline" - { - echo "TESTID=${{ inputs.test_id }}" - echo "K6_CLUSTER_NODES=${{ inputs.cluster_nodes }}" - echo "K6_TOPOLOGY_NAME=${{ inputs.topology }}" - echo "K6_WORKLOAD_NAME=${{ inputs.workload }}" - echo "K6_TEST_DURATION=${{ inputs.duration }}" - echo "K6_VU_PER_ROUTE=${{ inputs.vu }}" - echo "K6_REQUESTS_PER_SECOND_PER_VU=${{inputs.rate }}" - } >> $GITHUB_ENV - else - echo "The workflow is triggered manually" - { - echo "TESTID=${{ github.event.inputs.test_id }}" - echo "K6_CLUSTER_NODES=${{ github.event.inputs.cluster_nodes }}" - echo "K6_TOPOLOGY_NAME=${{ github.event.inputs.topology }}" - echo "K6_WORKLOAD_NAME=${{ github.event.inputs.workload }}" - echo "K6_TEST_DURATION=${{ github.event.inputs.duration }}" - echo "K6_VU_PER_ROUTE=${{ github.event.inputs.vu }}" - echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ github.event.inputs.rate }}" - } >> $GITHUB_ENV - fi + PREFIX="${{ github.event.inputs.test_id != '' && 'github.event.inputs.' || 'inputs.' }}" + { + echo "TESTID=${{ github.event.inputs.test_id != '' && github.event.inputs.test_id || inputs.test_id }}" + echo "K6_CLUSTER_NODES=${{ github.event.inputs.test_id != '' && github.event.inputs.cluster_nodes || inputs.cluster_nodes }}" + echo "K6_TOPOLOGY_NAME=${{ github.event.inputs.test_id != '' && github.event.inputs.topology || inputs.topology }}" + echo "K6_WORKLOAD_NAME=${{ github.event.inputs.test_id != '' && github.event.inputs.workload || inputs.workload }}" + echo "K6_TEST_DURATION=${{ github.event.inputs.test_id != '' && github.event.inputs.duration || inputs.duration }}" + echo "K6_VU_PER_ROUTE=${{ github.event.inputs.test_id != '' && github.event.inputs.vu || inputs.vu }}" + echo "K6_REQUESTS_PER_SECOND_PER_VU=${{ github.event.inputs.test_id != '' && github.event.inputs.rate || inputs.rate }}" + } >> $GITHUB_ENV
Line range hint
152-157
: Consider making bootstrap wait time configurableThe hardcoded 2-minute bootstrap wait time could be insufficient for larger deployments or slower environments. Consider making this configurable through an input parameter.
+ bootstrap_duration: + type: number + default: 2 + required: false + description: 'Bootstrap wait time in minutes' - sleep 2m # Wait for test to bootstrap + sleep "${BOOTSTRAP_DURATION:-2}m" # Wait for test to bootstrap
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/load-tests.yaml
(6 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/load-tests.yaml (1)
Learnt from: ausias-armesto
PR: hoprnet/hoprnet#6640
File: .github/workflows/load-tests.yaml:13-15
Timestamp: 2024-11-18T10:01:11.871Z
Learning: In GitHub Actions workflows, inputs under `workflow_call` do not support the `enum` property; this property is only available under `workflow_dispatch`.
🪛 actionlint (1.7.3)
.github/workflows/load-tests.yaml
145-145: shellcheck reported issue in this script: SC2086:info:2:15: Double quote to prevent globbing and word splitting
(shellcheck)
🔇 Additional comments (1)
.github/workflows/load-tests.yaml (1)
13-15
: LGTM! Input parameters are well-structured
The new parameters (cluster_nodes
, topology
, vu
) and updated rate
parameter are properly defined with appropriate types and descriptions. The changes align well with the websocket implementation requirements.
Also applies to: 16-30, 37-79
Changes the invocation method of the load tests so it accepts the new web socket implementation