Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
feat(test): add container health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
paralta committed Aug 9, 2023
1 parent da2d4b3 commit 338aaa2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
19 changes: 0 additions & 19 deletions end_to_end_test/default_scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/openclarity/vmclarity/api/models"
"github.com/openclarity/vmclarity/end_to_end_test/helpers"
"github.com/openclarity/vmclarity/pkg/shared/utils"
"net/http"
"time"
)

Expand All @@ -34,24 +33,6 @@ var _ = Describe("Running a default scan (SBOM, vulnerabilities and exploits)",
apiScanConfig, err := client.PostScanConfig(ctx, helpers.GetDefaultScanConfig())
Expect(err).NotTo(HaveOccurred())

By("waiting until grype server is ready")
Eventually(func() bool {
_, err = http.Get("http://localhost:9991")
return err == nil
}, time.Second*600).Should(BeTrue())

By("waiting until trivy server is ready")
Eventually(func() bool {
_, err = http.Get("http://localhost:9992")
return err == nil
}, time.Second*600).Should(BeTrue())

By("waiting until exploit db server is ready")
Eventually(func() bool {
_, err = http.Get("http://localhost:1326")
return err == nil
}, time.Second*600).Should(BeTrue())

By("updating scan configuration to run now")
updateScanConfig := helpers.UpdateScanConfigToStartNow(apiScanConfig)
err = client.PatchScanConfig(ctx, *apiScanConfig.Id, updateScanConfig)
Expand Down
2 changes: 1 addition & 1 deletion end_to_end_test/testenv/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (e *Environment) Start(ctx context.Context) error {
Start: api.StartOptions{
Project: e.project,
Wait: true,
WaitTimeout: 2 * time.Minute,
WaitTimeout: 10 * time.Minute,
Services: e.Services(),
},
}
Expand Down
16 changes: 16 additions & 0 deletions installation/docker/dockercompose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ services:
- type: volume
source: apiserver-db-data
target: /data
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "8888"]
interval: 10s
retries: 60

orchestrator:
image: ${OrchestratorContainerImage:-ghcr.io/openclarity/vmclarity-orchestrator:latest}
Expand Down Expand Up @@ -83,6 +87,10 @@ services:
replicas: 1
restart_policy:
condition: on-failure
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "1326"]
interval: 10s
retries: 60

trivy-server:
image: ${TrivyServerContainerImage:-docker.io/aquasec/trivy:0.41.0}
Expand All @@ -96,6 +104,10 @@ services:
replicas: 1
restart_policy:
condition: on-failure
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "9992"]
interval: 10s
retries: 60

grype-server-init:
image: ${GrypeServerContainerImage:-ghcr.io/openclarity/grype-server:v0.4.0}
Expand Down Expand Up @@ -132,6 +144,10 @@ services:
- type: volume
source: grype-server-db
target: /data
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "9991"]
interval: 10s
retries: 60

freshclam-mirror:
image: ${FreshclamMirrorContainerImage:-ghcr.io/openclarity/freshclam-mirror:v0.1.0}
Expand Down

0 comments on commit 338aaa2

Please sign in to comment.