Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ jobs:
key: downloaded-${{ runner.os }}-${{ hashFiles('klone.yaml') }}-test-unit

- run: make -j test-unit test-helm
env:
# These environment variables are required to run the CyberArk client integration tests
ARK_DISCOVERY_API: https://platform-discovery.integration-cyberark.cloud/
ARK_SUBDOMAIN: ${{ secrets.ARK_SUBDOMAIN }}
ARK_USERNAME: ${{ secrets.ARK_USERNAME }}
ARK_SECRET: ${{ secrets.ARK_SECRET }}

test-e2e:
if: contains(github.event.pull_request.labels.*.name, 'test-e2e')
Expand Down
14 changes: 12 additions & 2 deletions hack/ark/test-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,16 @@ kubectl create secret generic agent-credentials \
--from-literal=ARK_SUBDOMAIN=$ARK_SUBDOMAIN \
--from-literal=ARK_DISCOVERY_API=$ARK_DISCOVERY_API

helm upgrade agent "oci://${ARK_CHART}@${ARK_CHART_DIGEST}" \
--version "${ARK_CHART_TAG}" \
Comment on lines -68 to -69
Copy link
Member Author

Choose a reason for hiding this comment

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

This combination of oci digest + --version does not work with Helm v4. See

# Create sample secrets in the cluster
kubectl create secret generic e2e-sample-secret-$(date '+%s') \
--namespace default \
--from-literal=username=${RANDOM}

# Deploy the disco-agent Helm chart using the image and chart digests.
#
# We use a non-existent tag and omit the `--version` flag, to work around a Helm
# v4 bug. See: https://github.com/helm/helm/issues/31600
helm upgrade agent "oci://${ARK_CHART}:NON_EXISTENT_TAG@${ARK_CHART_DIGEST}" \
--install \
--wait \
--create-namespace \
Expand All @@ -75,7 +83,9 @@ helm upgrade agent "oci://${ARK_CHART}@${ARK_CHART_DIGEST}" \
--set pprof.enabled=true \
--set fullnameOverride=disco-agent \
--set "image.digest=${ARK_IMAGE_DIGEST}" \
--set config.clusterName="e2e-test-cluster" \
--set config.clusterDescription="A temporary cluster for E2E testing. Contact @wallrj-cyberark." \
--set config.period=60s \
--set-json "podLabels={\"disco-agent.cyberark.cloud/test-id\": \"${RANDOM}\"}"

kubectl rollout status deployments/disco-agent --namespace "${NAMESPACE}"
Expand Down
4 changes: 2 additions & 2 deletions internal/cyberark/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestCyberArkClient_PutSnapshot_MockAPI(t *testing.T) {
require.NoError(t, err)

err = cl.PutSnapshot(ctx, dataupload.Snapshot{
ClusterID: "success-cluster-id",
ClusterID: "ffffffff-ffff-ffff-ffff-ffffffffffff",
AgentVersion: version.PreflightVersion,
})
require.NoError(t, err)
Expand Down Expand Up @@ -73,7 +73,7 @@ func TestCyberArkClient_PutSnapshot_RealAPI(t *testing.T) {
require.NoError(t, err)

err = cl.PutSnapshot(ctx, dataupload.Snapshot{
ClusterID: "bb068932-c80d-460d-88df-34bc7f3f3297",
ClusterID: "ffffffff-ffff-ffff-ffff-ffffffffffff",
AgentVersion: version.PreflightVersion,
})
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cyberark/dataupload/dataupload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestCyberArkClient_PutSnapshot_MockAPI(t *testing.T) {
{
name: "successful upload",
snapshot: dataupload.Snapshot{
ClusterID: "success-cluster-id",
ClusterID: "ffffffff-ffff-ffff-ffff-ffffffffffff",
AgentVersion: version.PreflightVersion,
},
authenticate: setToken("success-token"),
Expand Down
2 changes: 1 addition & 1 deletion internal/cyberark/dataupload/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
const (
successBearerToken = "success-token"

successClusterID = "success-cluster-id"
successClusterID = "ffffffff-ffff-ffff-ffff-ffffffffffff"
)

type mockDataUploadServer struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/client_cyberark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func fakeReadings() []*api.DataReading {
{
DataGatherer: "ark/discovery",
Data: &api.DiscoveryData{
ClusterID: "success-cluster-id",
ClusterID: "ffffffff-ffff-ffff-ffff-ffffffffffff",
ServerVersion: &k8sversion.Info{
GitVersion: "v1.21.0",
},
Expand Down