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: inconsistent failures #866

Merged
merged 14 commits into from
Nov 25, 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
8 changes: 5 additions & 3 deletions .github/workflows/flow-build-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ jobs:
- { name: "Node PEM Kill", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-pem-kill-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-pem-kill-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-pem-kill-coverage-report }}" }
- { name: "Node Local Hedera", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-local-hedera-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-local-hedera-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-local-hedera-coverage-report }}" }
- { name: "Node Local PTT", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-local-ptt-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-local-ptt-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-local-ptt-coverage-report }}" }
- { name: "Node Add", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-coverage-report }}" }
- { name: "Node Add Local", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-local-coverage-report }}" }
- { name: "Node Add - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-coverage-report }}" }
# Node Add tests are disabled and are not viable for the amount of memory available. The teacher crashes during
# the reconnect attempt.
# - { name: "Node Add", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-coverage-report }}" }
# - { name: "Node Add Local", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-local-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-local-coverage-report }}" }
# - { name: "Node Add - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-add-separate-commands-coverage-report }}" }
- { name: "Node Update", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-coverage-report }}" }
- { name: "Node Update - Separate commands", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-update-separate-commands-coverage-report }}" }
- { name: "Node Delete", npm-test-script: "test-${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-subdirectory: "${{ needs.env-vars.outputs.e2e-node-delete-test-subdir }}", coverage-report-name: "${{ needs.env-vars.outputs.e2e-node-delete-coverage-report }}" }
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/zxc-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,26 +314,28 @@ jobs:
name: ${{ inputs.e2e-node-local-ptt-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-local-ptt-test-subdir }}'

- name: Download E2E Node Add Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
with:
name: ${{ inputs.e2e-node-add-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-add-test-subdir }}'

- name: Download E2E Node Add Local Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
with:
name: ${{ inputs.e2e-node-add-local-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-add-local-test-subdir }}'

- name: Download E2E Node Add - Separate commands Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
with:
name: ${{ inputs.e2e-node-add-separate-commands-coverage-report }}
path: 'coverage/${{ inputs.e2e-node-add-separate-commands-test-subdir }}'
# Node Add tests are disabled and are not viable for the amount of memory available. The teacher crashes during
# the reconnect attempt.
# - name: Download E2E Node Add Coverage Report
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
# if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
# with:
# name: ${{ inputs.e2e-node-add-coverage-report }}
# path: 'coverage/${{ inputs.e2e-node-add-test-subdir }}'
#
# - name: Download E2E Node Add Local Coverage Report
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
# if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
# with:
# name: ${{ inputs.e2e-node-add-local-coverage-report }}
# path: 'coverage/${{ inputs.e2e-node-add-local-test-subdir }}'
#
# - name: Download E2E Node Add - Separate commands Coverage Report
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
# if: ${{ (inputs.enable-codecov-analysis || inputs.enable-codacy-coverage) && inputs.enable-e2e-coverage-report && !cancelled() && !failure() }}
# with:
# name: ${{ inputs.e2e-node-add-separate-commands-coverage-report }}
# path: 'coverage/${{ inputs.e2e-node-add-separate-commands-test-subdir }}'

- name: Download E2E Node Update Coverage Report
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
Expand Down
11 changes: 9 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default [
{
ignores: ['docs/**/*', 'dist/*'],
},
{
files: ['test/**/*.ts', 'src/**/*.ts'],
{ // all ts files
files: ['**/*.ts'],
plugins: {
headers: headers,
tsdoc: tsdoc,
Expand Down Expand Up @@ -69,6 +69,13 @@ export default [
'space-before-function-paren': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/class-literal-property-style': 'off',
'no-invalid-this': [ 'error', { capIsConstructor : false } ],
}
},
{ // test ts files
files: ['test/**/*.ts'],
rules: {
'no-invalid-this': [ 'off', { } ],
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"check": "remark . --quiet --frail && eslint . --ignore-pattern 'docs/*' --ignore-pattern 'dist/*'; cd docs; jsdoc -c jsdoc.conf.json && tsc",
"format": "remark . --quiet --frail --output && eslint --fix . --ignore-pattern 'docs/*' --ignore-pattern 'dist/*' && tsc",
"test-setup": "./test/e2e/setup-e2e.sh",
"build": "tsc && node resources/post-build-script.js"
"build": "rm -Rf dist && tsc && node resources/post-build-script.js"
},
"keywords": [
"solo",
Expand Down
16 changes: 16 additions & 0 deletions resources/post-build-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,23 @@ function copyResources(srcDir, targetDir) {
fs.cpSync(srcDir, targetDir, {recursive: true})
}

async function recursiveChmod(dir, mode) {
const files = await fs.promises.readdir(dir);
for (const file of files) {
const filePath = `${dir}/${file}`;
const stats = await fs.promises.stat(filePath);
if (stats.isDirectory()) {
await recursiveChmod(filePath, mode);
} else {
await fs.promises.chmod(filePath, mode);
}
}
}

// Usage
console.time('Copy package.json')
copyPackageJson(srcPackageJsonFilePath, targetPackageJsonFilePath)
console.time('Copy resources')
copyResources(srcResourcesDir, targetResourcesDir)
console.time('Update permissions')
await recursiveChmod(distDir, 0o755);
12 changes: 12 additions & 0 deletions src/commands/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

/**
* Set flag from the flag option
* @param y instance of yargs

Check warning on line 25 in src/commands/flags.ts

View workflow job for this annotation

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
* @param commandFlags a set of command flags

Check warning on line 26 in src/commands/flags.ts

View workflow job for this annotation

GitHub Actions / Code Style / Standard

tsdoc-param-tag-missing-hyphen: The @param block should be followed by a parameter name and then a hyphen
*
*/
export function setCommandFlags (y: any, ...commandFlags: CommandFlag[]) {
Expand Down Expand Up @@ -802,6 +802,17 @@
}
}

export const stakeAmounts: CommandFlag = {
constName: 'stakeAmounts',
name: 'stake-amounts',
definition: {
describe:
'The amount to be staked in the same order you list the node aliases with multiple node staked values comma seperated',
defaultValue: '',
type: 'string'
}
}

export const allFlags: CommandFlag[] = [
accountId,
amount,
Expand Down Expand Up @@ -862,6 +873,7 @@
replicaCount,
setAlias,
settingTxt,
stakeAmounts,
tlsClusterIssuerType,
tlsPrivateKey,
tlsPublicKey,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ export class NetworkCommand extends BaseCommand {
title: `Check Node: ${chalk.yellow(nodeAlias)}`,
task: async () =>
await self.k8.waitForPods([constants.POD_PHASE_RUNNING], [
'solo.hedera.com/type=network-node',
`solo.hedera.com/node-name=${nodeAlias}`
`solo.hedera.com/node-name=${nodeAlias}`,
'solo.hedera.com/type=network-node'
], 1, constants.PODS_RUNNING_MAX_ATTEMPTS, constants.PODS_RUNNING_DELAY)
})
}
Expand Down
1 change: 1 addition & 0 deletions src/commands/node/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*
*/
/* eslint-disable no-invalid-this */
import { FREEZE_ADMIN_ACCOUNT } from '../../core/constants.js'
import { constants, Templates } from '../../core/index.js'
import { PrivateKey } from '@hashgraph/sdk'
Expand Down
5 changes: 3 additions & 2 deletions src/commands/node/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,16 @@ export const STOP_FLAGS = {
export const START_FLAGS = {
requiredFlags: [
flags.namespace,
flags.releaseTag
flags.releaseTag,
],
requiredFlagsWithDisabledPrompt: [
flags.app,
],
optionalFlags: [
flags.quiet,
flags.nodeAliasesUnparsed,
flags.debugNodeAlias
flags.debugNodeAlias,
flags.stakeAmounts,
]
}

Expand Down
20 changes: 10 additions & 10 deletions src/commands/node/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import type { NodeCommand } from './index.js'
import type { NodeCommandTasks } from './tasks.js'
import { type Lease } from '../../core/lease/lease.js'
import { NodeSubcommandType } from '../../core/enumerations.js'

export class NodeCommandHandlers {
private readonly accountManager: AccountManager
Expand Down Expand Up @@ -108,14 +109,13 @@

deleteExecuteTaskList (argv: any) {
return [
this.tasks.checkAllNodesAreFrozen('existingNodeAliases'),
this.tasks.downloadNodeGeneratedFiles(),
this.tasks.prepareStagingDirectory('existingNodeAliases'),
this.tasks.copyNodeKeysToSecrets(),
this.tasks.refreshNodeList(),
this.tasks.copyNodeKeysToSecrets(),
this.tasks.checkAllNodesAreFrozen('existingNodeAliases'),
this.tasks.getNodeLogsAndConfigs(),
this.tasks.updateChartWithConfigMap('Update chart to use new configMap'),
this.tasks.updateChartWithConfigMap('Delete network node', NodeSubcommandType.DELETE),
this.tasks.killNodes(),
this.tasks.sleep('Give time for pods to come up after being killed', 20000),
this.tasks.checkNodePodsAreRunning(),
Expand All @@ -126,7 +126,7 @@
this.tasks.enablePortForwarding(),
this.tasks.checkAllNodesAreActive('allNodeAliases'),
this.tasks.checkAllNodeProxiesAreActive(),
this.tasks.triggerStakeWeightCalculate(),
this.tasks.triggerStakeWeightCalculate(NodeSubcommandType.DELETE),
this.tasks.finalize()
]
}
Expand Down Expand Up @@ -159,12 +159,12 @@

addExecuteTasks (argv: any) {
return [
this.tasks.checkAllNodesAreFrozen('existingNodeAliases'),

Check warning on line 162 in src/commands/node/handlers.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/node/handlers.ts#L162

Added line #L162 was not covered by tests
this.tasks.downloadNodeGeneratedFiles(),
this.tasks.prepareStagingDirectory('allNodeAliases'),
this.tasks.copyNodeKeysToSecrets(),
this.tasks.checkAllNodesAreFrozen('existingNodeAliases'),
this.tasks.getNodeLogsAndConfigs(),
this.tasks.updateChartWithConfigMap('Deploy new network node'),
this.tasks.updateChartWithConfigMap('Deploy new network node', NodeSubcommandType.ADD),

Check warning on line 167 in src/commands/node/handlers.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/node/handlers.ts#L167

Added line #L167 was not covered by tests
this.tasks.killNodes(),
this.tasks.checkNodePodsAreRunning(),
this.tasks.populateServiceMap(),
Expand All @@ -177,7 +177,7 @@
this.tasks.checkAllNodesAreActive('allNodeAliases'),
this.tasks.checkAllNodeProxiesAreActive(),
this.tasks.stakeNewNode(),
this.tasks.triggerStakeWeightCalculate(),
this.tasks.triggerStakeWeightCalculate(NodeSubcommandType.ADD),

Check warning on line 180 in src/commands/node/handlers.ts

View check run for this annotation

Codecov / codecov/patch

src/commands/node/handlers.ts#L180

Added line #L180 was not covered by tests
this.tasks.finalize()
]
}
Expand All @@ -202,13 +202,13 @@

updateExecuteTasks (argv) {
return [
this.tasks.checkAllNodesAreFrozen('existingNodeAliases'),
this.tasks.downloadNodeGeneratedFiles(),
this.tasks.prepareStagingDirectory('allNodeAliases'),
this.tasks.copyNodeKeysToSecrets(),
this.tasks.checkAllNodesAreFrozen('existingNodeAliases'),
this.tasks.getNodeLogsAndConfigs(),
this.tasks.updateChartWithConfigMap(
'Update chart to use new configMap due to account number change',
'Update chart to use new configMap due to account number change', NodeSubcommandType.UPDATE,
(ctx: any) => !ctx.config.newAccountNumber && !ctx.config.debugNodeAlias
),
this.tasks.killNodesAndUpdateConfigMap(),
Expand All @@ -219,7 +219,7 @@
this.tasks.enablePortForwarding(),
this.tasks.checkAllNodesAreActive('allNodeAliases'),
this.tasks.checkAllNodeProxiesAreActive(),
this.tasks.triggerStakeWeightCalculate(),
this.tasks.triggerStakeWeightCalculate(NodeSubcommandType.UPDATE),
this.tasks.finalize()
]
}
Expand Down
Loading
Loading