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 allSettle for dump logs #1891

Merged
merged 2 commits into from
Oct 3, 2024
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
37 changes: 19 additions & 18 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ variables:
CACHE_COMPRESSION_LEVEL: "fastest"
FF_USE_FASTZIP: "true"
PUSHGATEWAY_URL: "http://zombienet-prometheus-pushgateway.managed-monitoring:9091/metrics/job/zombie-metrics"
DEBUG: "zombie,zombie::network-node,zombie::kube::client::logs"

cache:
- key:
Expand Down Expand Up @@ -249,26 +250,26 @@ zombienet-upgrade-node:
--local-dir="${LOCAL_DIR}"
--test="0001-upgrade-node.zndsl"

paras:
extends:
- .zombienet-common
variables:
GH_DIR: "https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/paras"
# paras:
# extends:
# - .zombienet-common
# variables:
# GH_DIR: "https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/paras"

before_script:
- echo "Zombienet Paras smoke test"
- echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
- echo "${GH_DIR}"
- export DEBUG=zombie
- export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
- export BIFROST_COL_IMAGE=docker.io/bifrostnetwork/bifrost:latest
- export MOONBEAM_COL_IMAGE=docker.io/purestake/moonbeam:v0.26
- export OAK_COL_IMAGE=docker.io/oaknetwork/turing:latest
# before_script:
# - echo "Zombienet Paras smoke test"
# - echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}"
# - echo "${GH_DIR}"
# - export DEBUG=zombie
# - export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
# - export BIFROST_COL_IMAGE=docker.io/bifrostnetwork/bifrost:latest
# - export MOONBEAM_COL_IMAGE=docker.io/purestake/moonbeam:v0.26
# - export OAK_COL_IMAGE=docker.io/oaknetwork/turing:latest

script:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}"
--test="paras.zndsl"
# script:
# - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
# --local-dir="${LOCAL_DIR}"
# --test="paras.zndsl"

# db-snapshot:
# extends:
Expand Down
15 changes: 11 additions & 4 deletions javascript/packages/orchestrator/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,24 @@ export class Network {
async dumpLogs(showLogPath = true): Promise<string> {
const logsPath = this.tmpDir + "/logs";
// create dump directory in local temp
if (!fs.existsSync(logsPath)) fs.mkdirSync(logsPath);
try {
await fs.promises.access(
logsPath,
fs.promises.constants.R_OK | fs.promises.constants.W_OK,
);
} catch {
// create dir
await fs.promises.mkdir(logsPath);
}

const paraNodes: NetworkNode[] = Object.values(this.paras).reduce(
(memo: NetworkNode[], value) => memo.concat(value.nodes),
[],
);

const dumpsNodes = this.relay.concat(paraNodes);
await Promise.allSettled(
dumpsNodes.map((node) => {
this.client.dumpLogs(this.tmpDir, node.name);
}),
dumpsNodes.map((node) => this.client.dumpLogs(this.tmpDir, node.name)),
);

if (showLogPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ export class KubeClient extends Client {
return result.stdout.split(",");
}

async dumpLogs(path: string, podName: string) {
async dumpLogs(path: string, podName: string): Promise<void> {
const dstFileName = `${path}/logs/${podName}.log`;
const logs = await this.getNodeLogs(podName);
await fs.writeFile(dstFileName, logs);
Expand Down
Loading