-
Notifications
You must be signed in to change notification settings - Fork 0
ROX-31495: wiremock for central #32
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
Open
janisz
wants to merge
9
commits into
main
Choose a base branch
from
ROX-31495-wiremock-mock-service
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,196
−20
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5fbca6c
ROX-31495: Add WireMock standalone mock service for StackRox Central
janisz cef9fbf
Simplify smoke test to focus on functionality
janisz 07bf2c0
chore: cleanup WireMock code and documentation
janisz a157c6b
feat: Use go mod cache for proto files instead of manual repo clone
janisz cf2af0c
feat: Add E2E test infrastructure with mock/real service support
janisz 15497ef
fix: Configure E2E tests to work with WireMock mock service
janisz 01f58ab
fix: Fix WireMock JSONPath patterns for gRPC protobuf field names
janisz ad34e28
fix: Fix WireMock smoke test failures and add grpcurl dependency
janisz a878c6f
Delete IMPLEMENTATION_SUMMARY.md
janisz 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: WireMock Smoke Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
|
|
||
| jobs: | ||
| wiremock-smoke-test: | ||
| name: WireMock Smoke Test | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Set up Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '11' | ||
|
|
||
| - name: Install protoc | ||
| run: | | ||
| PROTOC_VERSION=3.20.1 | ||
| PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip | ||
| curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP} | ||
| sudo unzip -o ${PROTOC_ZIP} -d /usr/local bin/protoc | ||
| sudo unzip -o ${PROTOC_ZIP} -d /usr/local 'include/*' | ||
| rm -f ${PROTOC_ZIP} | ||
|
|
||
| - name: Download Go dependencies | ||
| run: go mod download | ||
|
|
||
| - name: Setup proto files from go mod cache | ||
| run: ./scripts/setup-proto-files.sh | ||
|
|
||
| - name: Run smoke test | ||
| run: ./scripts/smoke-test-wiremock.sh | ||
|
|
||
| - name: Upload logs on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: wiremock-logs | ||
| path: wiremock/wiremock.log | ||
| if-no-files-found: ignore |
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,143 @@ | ||
| kind: Eval | ||
| metadata: | ||
| name: "stackrox-mcp-e2e" | ||
| config: | ||
| agent: | ||
| type: "builtin.claude-code" | ||
| model: "claude-sonnet-4-5" | ||
| llmJudge: | ||
| env: | ||
| baseUrlKey: JUDGE_BASE_URL | ||
| apiKeyKey: JUDGE_API_KEY | ||
| modelNameKey: JUDGE_MODEL_NAME | ||
| mcpConfigFile: mcp-config-mock.yaml | ||
| taskSets: | ||
| # Assertion Fields Explained: | ||
| # - toolsUsed: List of tools that MUST be called at least once | ||
| # - minToolCalls: Minimum TOTAL number of tool calls across ALL tools (not per-tool) | ||
| # - maxToolCalls: Maximum TOTAL number of tool calls across ALL tools (prevents runaway tool usage) | ||
| # Example: If maxToolCalls=3, the agent can make up to 3 tool calls total in the test, | ||
| # regardless of which tools are called. | ||
|
|
||
| # Test 1: List clusters | ||
| - path: tasks/list-clusters.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "list_clusters" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 1 | ||
|
|
||
| # Test 2: CVE detected in workloads | ||
| # Claude does comprehensive CVE checking (orchestrator, deployments, nodes) | ||
| - path: tasks/cve-detected-workloads.yaml | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should change this. Right now "contains" supports both - no CVE and there is CVE. We should for sure expect that LLM displays CVE and relevant workloads. |
||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_deployments_for_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2021-31805" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 3 | ||
|
|
||
| # Test 3: CVE detected in clusters - basic | ||
| - path: tasks/cve-detected-clusters.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_clusters_with_orchestrator_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2016-1000031" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 3 | ||
|
|
||
| # Test 4: Non-existent CVE | ||
| # Expects 3 calls because "Is CVE detected in my clusters?" triggers comprehensive check | ||
| # (orchestrator, deployments, nodes). The LLM cannot know beforehand if CVE exists. | ||
| - path: tasks/cve-nonexistent.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_clusters_with_orchestrator_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2099-00001" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 3 | ||
|
|
||
| # Test 5: CVE with specific cluster filter (does exist) | ||
| # Claude does comprehensive checking even for single cluster (orchestrator, deployments, nodes) | ||
| - path: tasks/cve-cluster-does-exist.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "list_clusters" | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_clusters_with_orchestrator_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2016-1000031" | ||
| minToolCalls: 2 | ||
| maxToolCalls: 4 | ||
|
|
||
| # Test 6: CVE with specific cluster filter (does not exist) | ||
| # Claude does comprehensive checking even when cluster doesn't exist | ||
| - path: tasks/cve-cluster-does-not-exist.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "list_clusters" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 5 | ||
|
|
||
| # Test 7: CVE detected in clusters - general | ||
| - path: tasks/cve-clusters-general.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_clusters_with_orchestrator_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2021-31805" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 5 | ||
|
|
||
| # Test 8: CVE check with cluster list reference | ||
| - path: tasks/cve-cluster-list.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_clusters_with_orchestrator_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2024-52577" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 5 | ||
|
|
||
| # Test 9: Log4shell (well-known CVE) | ||
| - path: tasks/cve-log4shell.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_deployments_for_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2021-44228" | ||
| minToolCalls: 1 | ||
| maxToolCalls: 3 | ||
|
|
||
| # Test 10: Multiple CVEs in one prompt | ||
| - path: tasks/cve-multiple.yaml | ||
| assertions: | ||
| toolsUsed: | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_deployments_for_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2021-31805" | ||
| - server: stackrox-mcp | ||
| toolPattern: "get_deployments_for_cve" | ||
| argumentsMatch: | ||
| cveName: "CVE-2016-1000031" | ||
| minToolCalls: 2 | ||
| maxToolCalls: 6 | ||
|
|
||
| # Test 11: RHSA detection (should fail gracefully) | ||
| - path: tasks/rhsa-not-supported.yaml | ||
| assertions: | ||
| minToolCalls: 0 | ||
| maxToolCalls: 1 | ||
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.
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.
Separating tasks from eval configuration makes even less sense now.
We could have one task used for demo and mock. In one case, we don't have any CVE detected, in another, we do have. And we are using the same judging prompt. So the judging prompt will match anything.
Can we organise this differently? Maybe we can have in one directory all mock tasks together with the evaluation config, and in another directory all tasks (and config) for staging demo.
i.e.