Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: no need to test k8 copy functionality with large file #174

Merged
merged 1 commit into from
Mar 21, 2024
Merged
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
18 changes: 5 additions & 13 deletions test/e2e/core/k8_e2e.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import os from 'os'
import path from 'path'
import { v4 as uuid4 } from 'uuid'
import { FullstackTestingError } from '../../../src/core/errors.mjs'
import { ConfigManager, constants, logging, PackageDownloader, Templates } from '../../../src/core/index.mjs'
import { ConfigManager, constants, logging, Templates } from '../../../src/core/index.mjs'
import { K8 } from '../../../src/core/k8.mjs'

describe('K8', () => {
const testLogger = logging.NewLogger('debug')
const configManager = new ConfigManager(testLogger)
const k8 = new K8(configManager, testLogger)
const downloader = new PackageDownloader(testLogger)

beforeAll(() => {
configManager.load()
Expand Down Expand Up @@ -77,20 +76,13 @@ describe('K8', () => {
const podName = Templates.renderNetworkPodName('node0')
const containerName = constants.ROOT_CONTAINER

// attempt fetch platform jar as we need to check if a big zip file can be uploaded/downloaded
const testCacheDir = 'test/data/tmp'
const tag = 'v0.42.5'
const releasePrefix = Templates.prepareReleasePrefix(tag)
const pkgPath = `${testCacheDir}/${releasePrefix}/build-${tag}.zip`
await expect(downloader.fetchPlatform(tag, testCacheDir)).resolves.toBe(pkgPath)
expect(fs.existsSync(pkgPath)).toBeTruthy()

const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'k8-'))
const destDir = constants.HEDERA_USER_HOME_DIR
const destPath = `${destDir}/build-${tag}.zip`
const srcPath = 'test/data/pem/keys/a-private-node0.pem'
const destPath = `${destDir}/a-private-node0.pem`

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

// download the same file
await expect(k8.copyFrom(podName, containerName, destPath, tmpDir)).resolves.toBeTruthy()
Expand All @@ -99,7 +91,7 @@ describe('K8', () => {
await expect(k8.execContainer(podName, containerName, ['rm', '-f', destPath])).resolves

fs.rmdirSync(tmpDir, { recursive: true })
}, 300000)
}, 20000)

it('should be able to port forward gossip port', (done) => {
const podName = Templates.renderNetworkPodName('node0')
Expand Down