Skip to content

Commit 3da67a3

Browse files
committed
working version with dump saved state
Signed-off-by: Jeromy Cannon <[email protected]>
1 parent 1dc4473 commit 3da67a3

File tree

3 files changed

+53
-7
lines changed

3 files changed

+53
-7
lines changed

src/commands/node.mjs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,29 @@ export class NodeCommand extends BaseCommand {
938938
title: 'Identify network pods',
939939
task: (ctx, task) => self.taskCheckNetworkNodePods(ctx, task)
940940
},
941+
{
942+
title: 'Dump network nodes saved state',
943+
task:
944+
async (ctx, task) => {
945+
const subTasks = []
946+
for (const nodeId of ctx.config.nodeIds) {
947+
const podName = ctx.config.podNames[nodeId]
948+
subTasks.push({
949+
title: `Node: ${chalk.yellow(nodeId)}`,
950+
task: async () =>
951+
await self.k8.execContainer(podName, constants.ROOT_CONTAINER, ['bash', '-c', `rm -rf ${constants.HEDERA_HAPI_PATH}/data/saved/*`])
952+
})
953+
}
954+
955+
// set up the sub-tasks
956+
return task.newListr(subTasks, {
957+
concurrent: true, // since we download in the container directly, we want this to be in parallel across all nodes
958+
rendererOptions: {
959+
collapseSubtasks: false
960+
}
961+
})
962+
}
963+
},
941964
{ // TODO DRY
942965
title: 'Fetch platform software into network nodes',
943966
task:
@@ -1030,6 +1053,26 @@ export class NodeCommand extends BaseCommand {
10301053
})
10311054
}
10321055
},
1056+
{
1057+
title: 'Check nodes are ACTIVE',
1058+
task: (ctx, task) => {
1059+
const subTasks = []
1060+
for (const nodeId of ctx.config.nodeIds) {
1061+
subTasks.push({
1062+
title: `Check node: ${chalk.yellow(nodeId)}`,
1063+
task: () => self.checkNetworkNodeStarted(nodeId)
1064+
})
1065+
}
1066+
1067+
// set up the sub-tasks
1068+
return task.newListr(subTasks, {
1069+
concurrent: false,
1070+
rendererOptions: {
1071+
collapseSubtasks: false
1072+
}
1073+
})
1074+
}
1075+
},
10331076
{
10341077
title: 'Check node proxies are ACTIVE',
10351078
// this is more reliable than checking the nodes logs for ACTIVE, as the

test/e2e/commands/node.test.mjs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe.each([
5858
await accountManager.close()
5959
})
6060

61-
describe(`Node should start successfully [release ${input.releaseTag}, keyFormat: ${input.keyFormat}]`, () => {
61+
describe.skip(`Node should start successfully [release ${input.releaseTag}, keyFormat: ${input.keyFormat}]`, () => {
6262
it('Balance query should succeed', async () => {
6363
expect.assertions(2)
6464

@@ -115,7 +115,7 @@ describe.each([
115115
}, 20000)
116116
})
117117

118-
describe(`Killed node should refresh successfully [release ${input.releaseTag}, keyFormat: ${input.keyFormat}]`, () => {
118+
describe.skip(`Killed node should refresh successfully [release ${input.releaseTag}, keyFormat: ${input.keyFormat}]`, () => {
119119
let podName = ''
120120
beforeAll(async () => {
121121
argv[flags.nodeIDs.name] = 'node0'
@@ -201,18 +201,15 @@ describe.each([
201201

202202
describe(`Stopped node should refresh successfully [release ${input.releaseTag}, keyFormat: ${input.keyFormat}]`, () => {
203203
let podName = ''
204+
204205
beforeAll(async () => {
205206
argv[flags.nodeIDs.name] = 'node0'
206207
const configManager = getTestConfigManager(`${testName}-solo.config`)
207208
configManager.update(argv, true)
208-
209209
const podArray = await k8.getPodsByLabel(['app=network-node0', 'fullstack.hedera.com/type=network-node'])
210210

211211
if (podArray.length > 0) {
212212
podName = podArray[0].metadata.name
213-
const resp = await k8.kubeClient.deleteNamespacedPod(podName, namespace)
214-
expect(resp.response.statusCode).toEqual(200)
215-
await sleep(20000) // sleep to wait for pod to finish terminating
216213
} else {
217214
throw new Error('pod for node0 not found')
218215
}
@@ -232,6 +229,7 @@ describe.each([
232229

233230
it('Node0 should not be ACTIVE', async () => {
234231
expect(3)
232+
await expect(nodeCmd.stop(argv)).resolves.toBeTruthy()
235233
expect(podName).toContain('node0')
236234
try {
237235
await expect(nodeCmd.checkNetworkNodeStarted('node0', 5)).rejects.toThrowError()

test/test_util.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*
1616
*/
17-
import { describe, expect, it } from '@jest/globals'
17+
import { beforeAll, describe, expect, it } from '@jest/globals'
1818
import fs from 'fs'
1919
import os from 'os'
2020
import path from 'path'
@@ -186,6 +186,11 @@ export function bootstrapNetwork (testName, argv,
186186
}
187187
}
188188

189+
const pvcs = await k8.listPvcsByNamespace(namespace)
190+
for (const pvc of pvcs) {
191+
await k8.deletePvc(pvc, namespace)
192+
}
193+
189194
if (!await chartManager.isChartInstalled(constants.FULLSTACK_SETUP_NAMESPACE, constants.FULLSTACK_CLUSTER_SETUP_CHART)) {
190195
await clusterCmd.setup(argv)
191196
}

0 commit comments

Comments
 (0)