diff --git a/charts/fullstack-deployment/templates/_helpers.tpl b/charts/fullstack-deployment/templates/_helpers.tpl index 6b039d8f0..f142bcc2a 100644 --- a/charts/fullstack-deployment/templates/_helpers.tpl +++ b/charts/fullstack-deployment/templates/_helpers.tpl @@ -1,11 +1,13 @@ {{- define "fullstack.testLabels" -}} -{{- if .Values.deployment.testMetadata.enabled }} -fullstack.hedera.com/testSuiteName: {{ .Values.deployment.testMetadata.testSuiteName }} -fullstack.hedera.com/testName: {{ .Values.deployment.testMetadata.testName }} -fullstack.hedera.com/testRunUID: {{ .Values.deployment.testMetadata.testRunUID }} -fullstack.hedera.com/testCreationTimestamp: {{ .Values.deployment.testMetadata.testCreationTimestamp }} -fullstack.hedera.com/testExpirationTimestamp: {{ .Values.deployment.testMetadata.testExpirationTimestamp }} -fullstack.hedera.com/testRequester: {{ .Values.deployment.testMetadata.testRequester }} +{{- if .Values.deployment.testMetadata.enabled -}} +{{- with .Values.deployment.testMetadata -}} +fullstack.hedera.com/testSuiteName: "{{ .testSuiteName }}" +fullstack.hedera.com/testName: "{{ .testName }}" +fullstack.hedera.com/testRunUID: "{{ .testRunUID }}" +fullstack.hedera.com/testCreationTimestamp: "{{ .testCreationTimestamp }}" +fullstack.hedera.com/testExpirationTimestamp: "{{ .testExpirationTimestamp }}" +fullstack.hedera.com/testRequester: "{{ .testRequester }}" +{{- end }} {{- end }} {{- end }} diff --git a/fullstack-network-manager/test/e2e/core/package_downloader_e2e.test.mjs b/fullstack-network-manager/test/e2e/core/package_downloader_e2e.test.mjs index ce41e10ed..56e012b66 100644 --- a/fullstack-network-manager/test/e2e/core/package_downloader_e2e.test.mjs +++ b/fullstack-network-manager/test/e2e/core/package_downloader_e2e.test.mjs @@ -1,7 +1,5 @@ import { describe, expect, it } from '@jest/globals' import * as fs from 'fs' -import * as path from 'path' -import * as os from 'os' import { logging, PackageDownloader, Templates } from '../../../src/core/index.mjs' describe('PackageDownloaderE2E', () => { @@ -9,17 +7,14 @@ describe('PackageDownloaderE2E', () => { const downloader = new PackageDownloader(testLogger) it('should succeed with a valid Hedera release tag', async () => { - const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'downloader-')) + const testCacheDir = 'test/data/tmp' const tag = 'v0.42.5' const releasePrefix = Templates.prepareReleasePrefix(tag) - const destPath = `${tmpDir}/${releasePrefix}/build-${tag}.zip` - await expect(downloader.fetchPlatform(tag, tmpDir)).resolves.toBe(destPath) + const destPath = `${testCacheDir}/${releasePrefix}/build-${tag}.zip` + await expect(downloader.fetchPlatform(tag, testCacheDir)).resolves.toBe(destPath) expect(fs.existsSync(destPath)).toBeTruthy() testLogger.showUser(destPath) - - // remove the downloaded files to reduce disk usage - fs.rmSync(`${tmpDir}`, { recursive: true }) - }, 100000) + }, 200000) }) diff --git a/fullstack-network-manager/test/e2e/core/platform_installer_e2e.test.mjs b/fullstack-network-manager/test/e2e/core/platform_installer_e2e.test.mjs index 8f047f715..081cbbb31 100644 --- a/fullstack-network-manager/test/e2e/core/platform_installer_e2e.test.mjs +++ b/fullstack-network-manager/test/e2e/core/platform_installer_e2e.test.mjs @@ -1,5 +1,5 @@ -import { describe, expect, it } from '@jest/globals' -import { PackageDownloader, PlatformInstaller, constants, logging, Kubectl } from '../../../src/core/index.mjs' +import { beforeAll, describe, expect, it } from '@jest/globals' +import { PackageDownloader, PlatformInstaller, constants, logging, Kubectl, Templates } from '../../../src/core/index.mjs' import * as fs from 'fs' import * as path from 'path' import * as os from 'os' @@ -9,10 +9,17 @@ describe('PackageInstallerE2E', () => { const kubectl = new Kubectl(testLogger) const installer = new PlatformInstaller(testLogger, kubectl) const downloader = new PackageDownloader(testLogger) + const testCacheDir = 'test/data/tmp' const podName = 'network-node0-0' const packageTag = 'v0.42.5' let packageFile = '' + beforeAll(() => { + if (!fs.existsSync(testCacheDir)) { + fs.mkdirSync(testCacheDir) + } + }) + describe('setupHapiDirectories', () => { it('should succeed with valid pod', async () => { expect.assertions(1) @@ -26,14 +33,20 @@ describe('PackageInstallerE2E', () => { }) describe('copyPlatform', () => { + it('should succeed fetching platform release', async () => { + const releasePrefix = Templates.prepareReleasePrefix(packageTag) + const destPath = `${testCacheDir}/${releasePrefix}/build-${packageTag}.zip` + await expect(downloader.fetchPlatform(packageTag, testCacheDir)).resolves.toBe(destPath) + expect(fs.existsSync(destPath)).toBeTruthy() + testLogger.showUser(destPath) + + // do not delete the cache dir + }, 200000) + it('should succeed with valid tag and pod', async () => { expect.assertions(1) try { - const tmpDir = 'test/data/tmp' - if (!fs.existsSync(tmpDir)) { - fs.mkdirSync(tmpDir) - } - packageFile = await downloader.fetchPlatform(packageTag, tmpDir) + packageFile = await downloader.fetchPlatform(packageTag, testCacheDir) await expect(installer.copyPlatform(podName, packageFile, true)).resolves.toBeTruthy() const outputs = await kubectl.execContainer(podName, constants.ROOT_CONTAINER, `ls -la ${constants.HAPI_PATH}`) testLogger.showUser(outputs)