-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use test-cache-dir to reduce reduce duplicate package download …
…execution test Signed-off-by: Lenin Mehedy <[email protected]>
- Loading branch information
1 parent
6a31048
commit 49160cd
Showing
2 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
15 changes: 6 additions & 9 deletions
15
fullstack-network-manager/test/e2e/core/package_downloader_e2e.test.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
import { describe, expect, it } from '@jest/globals' | ||
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' | ||
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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters