Skip to content

Commit 645d01c

Browse files
authored
Merge pull request #409 from snyk/chore/expect-pod-with-kubectl-run
chore: look for a Pod not a Deployment when using kubectl run in tests
2 parents a3ae257 + 2963165 commit 645d01c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/helpers/kubectl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function applyK8sYaml(pathToYamlDeployment: string): Promise<void>
6161
console.log(`Applied ${pathToYamlDeployment}`);
6262
}
6363

64-
export async function createDeploymentFromImage(name: string, image: string, namespace: string) {
64+
export async function createPodFromImage(name: string, image: string, namespace: string) {
6565
console.log(`Letting Kubernetes decide how to manage image ${image} with name ${name}`);
6666
await exec(`./kubectl run ${name} --image=${image} -n ${namespace} -- sleep 999999999`);
6767
console.log(`Done Letting Kubernetes decide how to manage image ${image} with name ${name}`);

test/integration/kubernetes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ tap.test('deploy sample workloads', async (t) => {
3939
kubectl.applyK8sYaml('./test/fixtures/redis-deployment.yaml'),
4040
kubectl.applyK8sYaml('./test/fixtures/centos-deployment.yaml'),
4141
kubectl.applyK8sYaml('./test/fixtures/scratch-deployment.yaml'),
42-
kubectl.createDeploymentFromImage('alpine-from-sha', someImageWithSha, servicesNamespace),
42+
kubectl.createPodFromImage('alpine-from-sha', someImageWithSha, servicesNamespace),
4343
]);
4444
t.pass('successfully deployed sample workloads');
4545
});
@@ -79,7 +79,7 @@ tap.test('snyk-monitor sends data to kubernetes-upstream', async (t) => {
7979
workloads.find((workload) => workload.name === 'redis' &&
8080
workload.type === WorkloadKind.Deployment) !== undefined &&
8181
workloads.find((workload) => workload.name === 'alpine-from-sha' &&
82-
workload.type === WorkloadKind.Deployment) !== undefined &&
82+
workload.type === WorkloadKind.Pod) !== undefined &&
8383
workloads.find((workload) => workload.name === 'busybox' &&
8484
workload.type === WorkloadKind.Deployment) !== undefined &&
8585
workloads.find((workload) => workload.name === 'centos' &&

0 commit comments

Comments
 (0)