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

fix(chart): use quote for test labels and fix e2e tests #560

Merged
merged 7 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
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
16 changes: 9 additions & 7 deletions charts/fullstack-deployment/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -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 }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
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', () => {
const testLogger = logging.NewLogger('debug')
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)
})
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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)
Expand All @@ -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)
Expand Down