Skip to content

Commit

Permalink
updated test case
Browse files Browse the repository at this point in the history
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
  • Loading branch information
jeromy-cannon committed Sep 12, 2024
1 parent 9ea29bc commit 2b4b72b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/e2e/core/k8_e2e.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,21 @@ describe('K8', () => {
it('should be able to copy a file to and from a container', async () => {
const pods = await k8.waitForPodReady([`app=${podLabelValue}`], 1, 20)
expect(pods.length).toStrictEqual(1)
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'k8-'))
const destDir = '/tmp'
const srcPath = 'test/data/pem/keys/a-private-node0.pem'
const destPath = `${destDir}/a-private-node0.pem`
const localTmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'k8-test'))
const remoteTmpDir = '/tmp'
const localFilePath = 'test/data/pem/keys/a-private-node0.pem'
const remoteFilePath = `${remoteTmpDir}/a-private-node0.pem`

// upload the file
await expect(k8.copyTo(podName, containerName, srcPath, destDir)).resolves.toBeTruthy()
await expect(k8.copyTo(podName, containerName, localFilePath, remoteTmpDir)).resolves.toBeTruthy()

// download the same file
await expect(k8.copyFrom(podName, containerName, destPath, tmpDir)).resolves.toBeTruthy()
await expect(k8.copyFrom(podName, containerName, remoteFilePath, localTmpDir)).resolves.toBeTruthy()

// rm file inside the container
await expect(k8.execContainer(podName, containerName, ['rm', '-f', destPath])).resolves
await expect(k8.execContainer(podName, containerName, ['rm', '-f', remoteFilePath])).resolves

fs.rmdirSync(tmpDir, { recursive: true })
fs.rmdirSync(localTmpDir, { recursive: true })
}, defaultTimeout)

it('should be able to port forward gossip port', (done) => {
Expand Down

0 comments on commit 2b4b72b

Please sign in to comment.