@@ -4,10 +4,10 @@ import * as tap from 'tap';
44import { WorkloadKind } from '../../src/supervisor/types' ;
55import { WorkloadMetadataValidator , WorkloadLocatorValidator } from '../helpers/types' ;
66import {
7- validateHomebaseStoredData ,
8- validateHomebaseStoredMetadata ,
9- getHomebaseResponseBody ,
10- } from '../helpers/homebase ' ;
7+ validateUpstreamStoredData ,
8+ validateUpstreamStoredMetadata ,
9+ getUpstreamResponseBody ,
10+ } from '../helpers/kubernetes-upstream ' ;
1111import { validateSecureConfiguration , validateVolumeMounts } from '../helpers/deployment' ;
1212import * as kubectl from '../helpers/kubectl' ;
1313
@@ -70,10 +70,10 @@ tap.test('snyk-monitor container started', async (t) => {
7070 console . log ( 'Done -- snyk-monitor exists!' ) ;
7171} ) ;
7272
73- tap . test ( 'snyk-monitor sends data to homebase ' , async ( t ) => {
73+ tap . test ( 'snyk-monitor sends data to kubernetes-upstream ' , async ( t ) => {
7474 t . plan ( 2 ) ;
7575
76- console . log ( `Begin polling Homebase for the expected workloads with integration ID ${ integrationId } ...` ) ;
76+ console . log ( `Begin polling kubernetes-upstream for the expected workloads with integration ID ${ integrationId } ...` ) ;
7777
7878 const validatorFn : WorkloadLocatorValidator = ( workloads ) => {
7979 return workloads !== undefined && workloads . length === 5 &&
@@ -95,16 +95,16 @@ tap.test('snyk-monitor sends data to homebase', async (t) => {
9595 'podSpec' in workloadInfo ;
9696 } ;
9797
98- // We don't want to spam Homebase with requests; do it infrequently
99- const homebaseDepGraphTestResult = await validateHomebaseStoredData (
98+ // We don't want to spam kubernetes-upstream with requests; do it infrequently
99+ const depGraphTestResult = await validateUpstreamStoredData (
100100 validatorFn , `api/v2/workloads/${ integrationId } /Default cluster/services` ) ;
101- t . ok ( homebaseDepGraphTestResult , 'snyk-monitor sent expected data to homebase in the expected timeframe' ) ;
102- const homebaseWorkloadMetadataResult = await validateHomebaseStoredMetadata ( metaValidator ,
101+ t . ok ( depGraphTestResult , 'snyk-monitor sent expected data to kubernetes-upstream in the expected timeframe' ) ;
102+ const workloadMetadataResult = await validateUpstreamStoredMetadata ( metaValidator ,
103103 `api/v1/workload/${ integrationId } /Default cluster/services/Deployment/redis` ) ;
104- t . ok ( homebaseWorkloadMetadataResult , 'snyk-monitor sent expected metadata in the expected timeframe' ) ;
104+ t . ok ( workloadMetadataResult , 'snyk-monitor sent expected metadata in the expected timeframe' ) ;
105105} ) ;
106106
107- tap . test ( 'snyk-monitor sends correct data to homebase after adding another deployment' , async ( t ) => {
107+ tap . test ( 'snyk-monitor sends correct data to kubernetes-upstream after adding another deployment' , async ( t ) => {
108108 t . plan ( 3 ) ;
109109
110110 const deploymentName = 'nginx-deployment' ;
@@ -114,27 +114,27 @@ tap.test('snyk-monitor sends correct data to homebase after adding another deplo
114114 const imageName = 'nginx' ;
115115
116116 await kubectl . applyK8sYaml ( './test/fixtures/nginx-deployment.yaml' ) ;
117- console . log ( `Begin polling Homebase for the expected workloads with integration ID ${ integrationId } ...` ) ;
117+ console . log ( `Begin polling kubernetes-upstream for the expected workloads with integration ID ${ integrationId } ...` ) ;
118118
119119 const validatorFn : WorkloadLocatorValidator = ( workloads ) => {
120120 return workloads !== undefined &&
121121 workloads . find ( ( workload ) => workload . name === deploymentName &&
122122 workload . type === WorkloadKind . Deployment ) !== undefined ;
123123 } ;
124124
125- const homebaseTestResult = await validateHomebaseStoredData (
125+ const testResult = await validateUpstreamStoredData (
126126 validatorFn , `api/v2/workloads/${ integrationId } /${ clusterName } /${ namespace } ` ) ;
127- t . ok ( homebaseTestResult , 'snyk-monitor sent expected data to homebase in the expected timeframe' ) ;
127+ t . ok ( testResult , 'snyk-monitor sent expected data to kubernetes-upstream in the expected timeframe' ) ;
128128
129- const depGraphResult = await getHomebaseResponseBody (
129+ const depGraphResult = await getUpstreamResponseBody (
130130 `api/v1/dependency-graphs/${ integrationId } /${ clusterName } /${ namespace } /${ deploymentType } /${ deploymentName } ` ) ;
131131 t . ok ( 'dependencyGraphResults' in depGraphResult ,
132132 'expected dependencyGraphResults field to exist in /dependency-graphs response' ) ;
133133 t . ok ( 'imageMetadata' in JSON . parse ( depGraphResult . dependencyGraphResults [ imageName ] ) ,
134- 'snyk-monitor sent expected data to homebase in the expected timeframe' ) ;
134+ 'snyk-monitor sent expected data to kubernetes-upstream in the expected timeframe' ) ;
135135} ) ;
136136
137- tap . test ( 'snyk-monitor pulls images from a private gcr.io registry and sends data to homebase ' , async ( t ) => {
137+ tap . test ( 'snyk-monitor pulls images from a private gcr.io registry and sends data to kubernetes-upstream ' , async ( t ) => {
138138 t . plan ( 3 ) ;
139139
140140 const deploymentName = 'debian-gcr-io' ;
@@ -152,19 +152,19 @@ tap.test('snyk-monitor pulls images from a private gcr.io registry and sends dat
152152 workload . type === WorkloadKind . Deployment ) !== undefined ;
153153 } ;
154154
155- const homebaseTestResult = await validateHomebaseStoredData (
155+ const testResult = await validateUpstreamStoredData (
156156 validatorFn , `api/v2/workloads/${ integrationId } /${ clusterName } /${ namespace } ` ) ;
157- t . ok ( homebaseTestResult , 'snyk-monitor sent expected data to upstream in the expected timeframe' ) ;
157+ t . ok ( testResult , 'snyk-monitor sent expected data to upstream in the expected timeframe' ) ;
158158
159- const depGraphResult = await getHomebaseResponseBody (
159+ const depGraphResult = await getUpstreamResponseBody (
160160 `api/v1/dependency-graphs/${ integrationId } /${ clusterName } /${ namespace } /${ deploymentType } /${ deploymentName } ` ) ;
161161 t . ok ( 'dependencyGraphResults' in depGraphResult ,
162162 'expected dependencyGraphResults field to exist in /dependency-graphs response' ) ;
163163 t . ok ( 'imageMetadata' in JSON . parse ( depGraphResult . dependencyGraphResults [ imageName ] ) ,
164164 'snyk-monitor sent expected data to upstream in the expected timeframe' ) ;
165165} ) ;
166166
167- tap . test ( 'snyk-monitor pulls images from a private ECR and sends data to homebase ' , async ( t ) => {
167+ tap . test ( 'snyk-monitor pulls images from a private ECR and sends data to kubernetes-upstream ' , async ( t ) => {
168168 if ( process . env [ 'TEST_PLATFORM' ] !== 'eks' ) {
169169 t . pass ( 'Not testing private ECR images because we\'re not running in EKS' ) ;
170170 return ;
@@ -187,43 +187,43 @@ tap.test('snyk-monitor pulls images from a private ECR and sends data to homebas
187187 workload . type === WorkloadKind . Deployment ) !== undefined ;
188188 } ;
189189
190- const homebaseTestResult = await validateHomebaseStoredData (
190+ const testResult = await validateUpstreamStoredData (
191191 validatorFn , `api/v2/workloads/${ integrationId } /${ clusterName } /${ namespace } ` ) ;
192- t . ok ( homebaseTestResult , 'snyk-monitor sent expected data to upstream in the expected timeframe' ) ;
192+ t . ok ( testResult , 'snyk-monitor sent expected data to upstream in the expected timeframe' ) ;
193193
194- const depGraphResult = await getHomebaseResponseBody (
194+ const depGraphResult = await getUpstreamResponseBody (
195195 `api/v1/dependency-graphs/${ integrationId } /${ clusterName } /${ namespace } /${ deploymentType } /${ deploymentName } ` ) ;
196196 t . ok ( 'dependencyGraphResults' in depGraphResult ,
197197 'expected dependencyGraphResults field to exist in /dependency-graphs response' ) ;
198198 t . ok ( 'imageMetadata' in JSON . parse ( depGraphResult . dependencyGraphResults [ imageName ] ) ,
199199 'snyk-monitor sent expected data to upstream in the expected timeframe' ) ;
200200} ) ;
201201
202- tap . test ( 'snyk-monitor sends deleted workload to homebase ' , async ( t ) => {
202+ tap . test ( 'snyk-monitor sends deleted workload to kubernetes-upstream ' , async ( t ) => {
203203 // First ensure the deployment exists from the previous test
204204 const deploymentValidatorFn : WorkloadLocatorValidator = ( workloads ) => {
205205 return workloads !== undefined &&
206206 workloads . find ( ( workload ) => workload . name === 'nginx-deployment' &&
207207 workload . type === WorkloadKind . Deployment ) !== undefined ;
208208 } ;
209209
210- const homebaseTestResult = await validateHomebaseStoredData ( deploymentValidatorFn ,
210+ const testResult = await validateUpstreamStoredData ( deploymentValidatorFn ,
211211 `api/v2/workloads/${ integrationId } /Default cluster/services` ) ;
212- t . ok ( homebaseTestResult , 'snyk-monitor sent expected data to homebase in the expected timeframe' ) ;
212+ t . ok ( testResult , 'snyk-monitor sent expected data to kubernetes-upstream in the expected timeframe' ) ;
213213
214214 const deploymentName = 'nginx-deployment' ;
215215 const namespace = 'services' ;
216216 await kubectl . deleteDeployment ( deploymentName , namespace ) ;
217217
218- // Finally, remove the workload and ensure that the snyk-monitor notifies Homebase
218+ // Finally, remove the workload and ensure that the snyk-monitor notifies kubernetes-upstream
219219 const deleteValidatorFn : WorkloadLocatorValidator = ( workloads ) => {
220220 return workloads !== undefined && workloads . every ( ( workload ) => workload . name !== 'nginx-deployment' ) ;
221221 } ;
222222
223223 const clusterName = 'Default cluster' ;
224- const homebaseDeleteTestResult = await validateHomebaseStoredData ( deleteValidatorFn ,
224+ const deleteTestResult = await validateUpstreamStoredData ( deleteValidatorFn ,
225225 `api/v2/workloads/${ integrationId } /${ clusterName } /${ namespace } ` ) ;
226- t . ok ( homebaseDeleteTestResult , 'snyk-monitor sent deleted workload data to homebase in the expected timeframe' ) ;
226+ t . ok ( deleteTestResult , 'snyk-monitor sent deleted workload data to kubernetes-upstream in the expected timeframe' ) ;
227227} ) ;
228228
229229tap . test ( `snyk-monitor has resource limits` , async ( t ) => {
@@ -277,7 +277,7 @@ tap.test('notify upstream of deleted pods that have no OwnerReference', async (t
277277 ) ;
278278 } ;
279279
280- const validationResult = await validateHomebaseStoredData (
280+ const validationResult = await validateUpstreamStoredData (
281281 validatorFn ,
282282 `api/v2/workloads/${ integrationId } /${ clusterName } /${ namespace } ` ,
283283 ) ;
0 commit comments