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: Refactor task and handler classes #1205

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Ivo-Yankov
Copy link
Contributor

@Ivo-Yankov Ivo-Yankov commented Jan 24, 2025

Description

This pull request changes the following:

  • TBD

Related Issues

Signed-off-by: Ivo Yankov <[email protected]>
# Conflicts:
#	src/commands/cluster/handlers.ts
#	src/commands/cluster/tasks.ts
Signed-off-by: Ivo Yankov <[email protected]>
@Ivo-Yankov Ivo-Yankov self-assigned this Jan 24, 2025
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Copy link
Contributor

github-actions bot commented Jan 24, 2025

Unit Test Results - Linux

  1 files  ±0   59 suites  ±0   3s ⏱️ -1s
233 tests ±0  233 ✅ ±0  0 💤 ±0  0 ❌ ±0 
238 runs  ±0  238 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 39a3a90. ± Comparison against base commit 4ab4dd5.

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Jan 24, 2025

Unit Test Results - Windows

  1 files  ±0   59 suites  ±0   14s ⏱️ -3s
233 tests ±0  233 ✅ ±0  0 💤 ±0  0 ❌ ±0 
238 runs  ±0  238 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 39a3a90. ± Comparison against base commit 4ab4dd5.

♻️ This comment has been updated with latest results.

Signed-off-by: Ivo Yankov <[email protected]>
# Conflicts:
#	src/commands/deployment.ts
#	src/core/config/remote/listr_config_tasks.ts
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Copy link
Contributor

github-actions bot commented Jan 27, 2025

E2E Test Report

 17 files  126 suites   1h 30m 40s ⏱️
258 tests 258 ✅ 0 💤 0 ❌
269 runs  269 ✅ 0 💤 0 ❌

Results for commit 39a3a90.

♻️ This comment has been updated with latest results.

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 4ab4dd51 91.51%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (4ab4dd5) Report Missing Report Missing Report Missing
Head commit (39a3a90) 21857 18306 83.75%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#1205) 530 485 91.51%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 91.50943% with 45 lines in your changes missing coverage. Please review.

Project coverage is 82.93%. Comparing base (d60247a) to head (39a3a90).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/core/command_handler.ts 74.76% 27 Missing ⚠️
src/commands/cluster/handlers.ts 87.87% 4 Missing ⚠️
src/commands/cluster/tasks.ts 95.65% 4 Missing ⚠️
src/commands/node/handlers.ts 94.91% 3 Missing ⚠️
src/commands/base.ts 66.66% 2 Missing ⚠️
src/commands/explorer.ts 71.42% 2 Missing ⚠️
src/commands/mirror_node.ts 75.00% 1 Missing ⚠️
src/commands/network.ts 90.00% 1 Missing ⚠️
src/commands/relay.ts 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1205      +/-   ##
==========================================
+ Coverage   82.89%   82.93%   +0.03%     
==========================================
  Files          78       80       +2     
  Lines       21763    21857      +94     
  Branches     1824     1996     +172     
==========================================
+ Hits        18041    18127      +86     
+ Misses       3584     3560      -24     
- Partials      138      170      +32     
Files with missing lines Coverage Δ
src/commands/cluster/configs.ts 84.67% <100.00%> (+0.11%) ⬆️
src/commands/cluster/index.ts 38.53% <100.00%> (-2.21%) ⬇️
src/commands/node/configs.ts 92.55% <100.00%> (+0.05%) ⬆️
src/commands/node/index.ts 17.09% <100.00%> (-5.55%) ⬇️
src/commands/node/tasks.ts 92.77% <100.00%> (+0.34%) ⬆️
src/core/config/remote/listr_config_tasks.ts 67.32% <100.00%> (+0.30%) ⬆️
src/core/config_builder.ts 100.00% <100.00%> (ø)
src/core/container_init.ts 95.00% <100.00%> (+0.33%) ⬆️
src/core/helpers.ts 83.09% <100.00%> (+1.22%) ⬆️
src/commands/mirror_node.ts 75.61% <75.00%> (ø)
... and 8 more

... and 8 files with indirect coverage changes

Impacted file tree graph

@Ivo-Yankov Ivo-Yankov marked this pull request as ready for review January 27, 2025 13:38
@Ivo-Yankov Ivo-Yankov requested review from leninmehedy and a team as code owners January 27, 2025 13:38
@Ivo-Yankov Ivo-Yankov added the PR: Needs Approval A pull request that needs reviews and approvals. label Jan 27, 2025
@@ -71,6 +67,7 @@ export abstract class BaseCommand extends ShellRunner {
this.remoteConfigManager = opts.remoteConfigManager;
}

// TODO remove
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

@@ -32,7 +32,8 @@ export class ClusterCommand extends BaseCommand {
constructor(opts: Opts) {
super(opts);

this.handlers = new ClusterCommandHandlers(this, new ClusterCommandTasks(this, this.k8), this.remoteConfigManager);
// TODO properly inject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

remoteConfigManager: opts.remoteConfigManager,
});

// TODO properly inject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

this.configManager = patchInject(configManager, ConfigManager, this.constructor.name);
}

commandActionBuilder(actionTasks: any, options: any, errorString: string, lease: Lease | null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add scope modifier public to method, add return type

* Setup home directories
* @param dirs a list of directories that need to be created in sequence
*/
setupHomeDirectory(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add scope modifier public to method, add return type

return dirs;
}

setupHomeDirectoryTask() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add scope modifier public to method, add return type

}

// Config related methods:
getConfig(configName: string, flags: CommandFlag[], extraProperties: string[] = []): object {
Copy link
Contributor

@jeromy-cannon jeromy-cannon Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add scope modifier public to method

return getConfig(this.configManager, this._configMaps, configName, flags, extraProperties);
}

getUnusedConfigs(configName: string): string[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add scope modifier public to method

@@ -228,16 +241,26 @@ describe('ClusterCommand unit tests', () => {
certificateManager: sandbox.createStubInstance(CertificateManager),
remoteConfigManager: remoteConfigManagerStub,
} as Opts;

// stubDependencies([Object.values(options)]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete commented out code

};

function stubDependencies(deps: any[]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still being used if it is commented out on line 245?

@jeromy-cannon jeromy-cannon added PR: Unresolved Comments A pull request where there are comments and they need to be resolved. and removed PR: Needs Approval A pull request that needs reviews and approvals. labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Unresolved Comments A pull request where there are comments and they need to be resolved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor task and handler classes
2 participants