Adding more tests and minor changes in code (#21)

* added cleanup job checks, started testing constants file

* added getVolumeClaimName test

* added write entrypoint tests

* added tests around k8s utils

* fixed new regexp

* added tests around runner instance label

* 100% test coverage of constants
This commit is contained in:
Nikola Jokic
2022-06-22 11:15:42 -07:00
committed by GitHub
parent 20c19dae27
commit eb47baaf5e
5 changed files with 377 additions and 9 deletions

View File

@@ -39,8 +39,8 @@ export function getSecretName(): string {
)}-secret-${uuidv4().substring(0, STEP_POD_NAME_SUFFIX_LENGTH)}`
}
const MAX_POD_NAME_LENGTH = 63
const STEP_POD_NAME_SUFFIX_LENGTH = 8
export const MAX_POD_NAME_LENGTH = 63
export const STEP_POD_NAME_SUFFIX_LENGTH = 8
export const JOB_CONTAINER_NAME = 'job'
export class RunnerInstanceLabel {

View File

@@ -20,18 +20,18 @@ export function containerVolumes(
}
]
const workspacePath = process.env.GITHUB_WORKSPACE as string
if (containerAction) {
const workspace = process.env.GITHUB_WORKSPACE as string
mounts.push(
{
name: POD_VOLUME_NAME,
mountPath: '/github/workspace',
subPath: workspace.substring(workspace.indexOf('work/') + 1)
subPath: workspacePath.substring(workspacePath.indexOf('work/') + 1)
},
{
name: POD_VOLUME_NAME,
mountPath: '/github/file_commands',
subPath: workspace.substring(workspace.indexOf('work/') + 1)
subPath: workspacePath.substring(workspacePath.indexOf('work/') + 1)
}
)
return mounts
@@ -63,7 +63,6 @@ export function containerVolumes(
return mounts
}
const workspacePath = process.env.GITHUB_WORKSPACE as string
for (const userVolume of userMountVolumes) {
let sourceVolumePath = ''
if (path.isAbsolute(userVolume.sourceVolumePath)) {