Skip to content

Commit 5ab03fa

Browse files
committed
fixed issue where even though the cache dir flag is set, it was still using environment variables instead.
Signed-off-by: Jeromy Cannon <jeromy@swirldslabs.com>
1 parent f5798d1 commit 5ab03fa

File tree

6 files changed

+86
-18
lines changed

6 files changed

+86
-18
lines changed

src/commands/base.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,15 @@ export abstract class BaseCommand extends ShellRunner {
329329
* Setup home directories
330330
* @param dirs a list of directories that need to be created in sequence
331331
*/
332-
public setupHomeDirectory(
333-
dirs: string[] = [
334-
constants.SOLO_HOME_DIR,
335-
constants.SOLO_LOGS_DIR,
336-
constants.SOLO_CACHE_DIR,
337-
constants.SOLO_VALUES_DIR,
338-
],
339-
) {
332+
public setupHomeDirectory(dirs: string[] = []) {
333+
if (dirs?.length === 0) {
334+
dirs = [
335+
constants.SOLO_HOME_DIR,
336+
constants.SOLO_LOGS_DIR,
337+
this.configManager.getFlag<string>(Flags.cacheDir),
338+
constants.SOLO_VALUES_DIR,
339+
];
340+
}
340341
const self = this;
341342

342343
try {

src/commands/flags.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ export class Flags {
884884
name: 'application-properties',
885885
definition: {
886886
describe: 'application.properties file for node',
887-
defaultValue: path.join(constants.SOLO_CACHE_DIR, 'templates', 'application.properties'),
887+
defaultValue: path.join('templates', 'application.properties'),
888888
type: 'string',
889889
},
890890
prompt: undefined,
@@ -897,7 +897,7 @@ export class Flags {
897897
describe:
898898
'the application.env file for the node provides environment variables to the solo-container' +
899899
' to be used when the hedera platform is started',
900-
defaultValue: path.join(constants.SOLO_CACHE_DIR, 'templates', 'application.env'),
900+
defaultValue: path.join('templates', 'application.env'),
901901
type: 'string',
902902
},
903903
prompt: undefined,
@@ -908,7 +908,7 @@ export class Flags {
908908
name: 'api-permission-properties',
909909
definition: {
910910
describe: 'api-permission.properties file for node',
911-
defaultValue: path.join(constants.SOLO_CACHE_DIR, 'templates', 'api-permission.properties'),
911+
defaultValue: path.join('templates', 'api-permission.properties'),
912912
type: 'string',
913913
},
914914
prompt: undefined,
@@ -919,7 +919,7 @@ export class Flags {
919919
name: 'bootstrap-properties',
920920
definition: {
921921
describe: 'bootstrap.properties file for node',
922-
defaultValue: path.join(constants.SOLO_CACHE_DIR, 'templates', 'bootstrap.properties'),
922+
defaultValue: path.join('templates', 'bootstrap.properties'),
923923
type: 'string',
924924
},
925925
prompt: undefined,
@@ -941,7 +941,7 @@ export class Flags {
941941
name: 'settings-txt',
942942
definition: {
943943
describe: 'settings.txt file for node',
944-
defaultValue: path.join(constants.SOLO_CACHE_DIR, 'templates', 'settings.txt'),
944+
defaultValue: path.join('templates', 'settings.txt'),
945945
type: 'string',
946946
},
947947
prompt: undefined,
@@ -1053,7 +1053,7 @@ export class Flags {
10531053
name: 'log4j2-xml',
10541054
definition: {
10551055
describe: 'log4j2.xml file for node',
1056-
defaultValue: path.join(constants.SOLO_CACHE_DIR, 'templates', 'log4j2.xml'),
1056+
defaultValue: path.join('templates', 'log4j2.xml'),
10571057
type: 'string',
10581058
},
10591059
prompt: undefined,

src/core/constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const PROFILE_TINY = 'tiny';
163163
export const PROFILE_LOCAL = 'local';
164164

165165
export const ALL_PROFILES = [PROFILE_LOCAL, PROFILE_TINY, PROFILE_SMALL, PROFILE_MEDIUM, PROFILE_LARGE];
166-
export const DEFAULT_PROFILE_FILE = path.join(SOLO_CACHE_DIR, 'profiles', 'custom-spec.yaml');
166+
export const DEFAULT_PROFILE_FILE = path.join('profiles', 'custom-spec.yaml');
167167

168168
export const STANDARD_DATAMASK = '***';
169169

src/core/profile_manager.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ export class ProfileManager {
5656
* @throws {IllegalArgumentError} if the profile file is not found.
5757
*/
5858
loadProfiles(forceReload = false): Map<string, AnyObject> {
59-
const profileFile = this.configManager.getFlag<string>(flags.profileFile);
59+
const profileFile = path.join(
60+
this.configManager.getFlag<string>(flags.cacheDir),
61+
this.configManager.getFlag<string>(flags.profileFile),
62+
);
6063
if (!profileFile) throw new MissingArgumentError('profileFile is required');
6164

6265
// return the cached value as quickly as possible
@@ -210,7 +213,10 @@ export class ProfileManager {
210213
);
211214

212215
for (const flag of flags.nodeConfigFileFlags.values()) {
213-
const filePath = this.configManager.getFlag<string>(flag);
216+
const filePath = path.join(
217+
this.configManager.getFlag<string>(flags.cacheDir),
218+
this.configManager.getFlag<string>(flag),
219+
);
214220
if (!filePath) {
215221
throw new SoloError(`Configuration file path is missing for: ${flag.name}`);
216222
}

test/data/local-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
userEmailAddress: joe@doe.com
22
soloVersion: '0.0.0'
33
deployments:
4+
relay-deployment:
5+
clusters:
6+
- e2e-cluster-1
7+
- e2e-cluster-2
8+
namespace: dual-cluster-relay-cmd-e2e
49
deployment:
510
clusters:
611
- cluster-1

test/e2e/commands/dual_cluster_relay.test.ts

+57-1
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,64 @@ e2eTestSuite(
9494
const contexts: string[] = splitFlagInput(argv[flags.context.name]);
9595
for (const context of contexts) {
9696
const k8 = bootstrapResp.opts.k8Factory.getK8(context);
97+
if (await k8.namespaces().has(namespace)) {
98+
await k8.namespaces().delete(namespace);
99+
}
100+
await k8.namespaces().create(namespace);
97101

98-
const data: Record<string, string> = {};
102+
const data: Record<string, string> = {
103+
'remote-config-data': `
104+
metadata:
105+
namespace: dual-cluster-relay-cmd-e2e
106+
deploymentName: relay-deployment
107+
lastUpdatedAt: 2025-02-14T22:10:13.586000Z
108+
lastUpdateBy: john@doe.com
109+
soloChartVersion: ""
110+
hederaPlatformVersion: ""
111+
hederaMirrorNodeChartVersion: ""
112+
hederaExplorerChartVersion: ""
113+
hederaJsonRpcRelayChartVersion: ""
114+
soloVersion: 0.34.0
115+
version: 1.0.0
116+
clusters:
117+
e2e-cluster-1:
118+
name: e2e-cluster-1
119+
namespace: dual-cluster-relay-cmd-e2e
120+
deployment: relay-deployment
121+
dnsBaseDomain: cluster.local
122+
dnsConsensusNodePattern: network-\${nodeAlias}-svc.\${namespace}.svc
123+
e2e-cluster-2:
124+
name: e2e-cluster-2
125+
namespace: dual-cluster-relay-cmd-e2e
126+
deployment: relay-deployment
127+
dnsBaseDomain: cluster.local
128+
dnsConsensusNodePattern: network-\${nodeAlias}-svc.\${namespace}.svc
129+
components:
130+
relays: {}
131+
haProxies: {}
132+
mirrorNodes: {}
133+
envoyProxies: {}
134+
consensusNodes:
135+
node1:
136+
name: node1
137+
cluster: e2e-cluster-1
138+
namespace: dual-cluster-relay-cmd-e2e
139+
state: requested
140+
nodeId: 0
141+
node2:
142+
name: node2
143+
cluster: e2e-cluster-2
144+
namespace: dual-cluster-relay-cmd-e2e
145+
state: requested
146+
nodeId: 1
147+
mirrorNodeExplorers: {}
148+
commandHistory:
149+
- deployment create
150+
lastExecutedCommand: deployment create
151+
flags:
152+
nodeAliasesUnparsed: node1,node2
153+
`,
154+
};
99155

100156
await k8
101157
.configMaps()

0 commit comments

Comments
 (0)