-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing conductor_url in aws code and improving handling of erro…
…r/warn conditions (#1130) # fix: missing conductor_url in aws code and improving handling of error/warn conditions ## JIRA Ticket [BSS-224](https://jira.csiro.au/browse/BSS-224) ## Description Fixes missing environment variable in conductor API configuration for AWS deployment. Refactors default conductor URLs to constants in the app and api code. Adds doc strings for conductor URL split method and handles error conditions more durably including filtering out empty values which could result from trailing commas, and warning under either empty string or empty list conditions. Falls through to the default value if the length of the list after splitting and filtering out empty values is zero, such as in the case where the environment variable is an empty string. ## How to Test 1. Testing changes to conductor URL splitting logic: I added unit tests for this function. See `cd app && npm i && npx vitest buildconfig`. 2. Testing AWS deployment - not on critical path right now but once merged I'll update the downstream fork and redeploy and ensure it works. ## Checklist - [x] I have confirmed all commits have been signed. - [x] I have added JSDoc style comments to any new functions or classes. - [x] Relevant documentation such as READMEs, guides, and class comments are updated.
- Loading branch information
Showing
5 changed files
with
108 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2021, 2022 Macquarie University | ||
* | ||
* Licensed under the Apache License Version 2.0 (the, "License"); | ||
* you may not use, this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing software | ||
* distributed under the License is distributed on an "AS IS" BASIS | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. | ||
* See, the License, for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* Filename: buildconfig.test.ts | ||
* Description: | ||
* This test file checks that the parsing of conductor URLs meets specifications | ||
*/ | ||
|
||
// eslint-disable-next-line n/no-unpublished-import | ||
import {expect, it, describe} from 'vitest'; | ||
import {DEFAULT_CONDUCTOR_URL, parseConductorUrls} from './buildconfig'; | ||
|
||
describe('parse conductor URLs', () => { | ||
it('defaults to the DEFAULT_CONDUCTOR_URL if empty string provided', () => { | ||
const res = parseConductorUrls(''); | ||
expect(res).toEqual([DEFAULT_CONDUCTOR_URL]); | ||
}); | ||
it('trims excess whitespace', () => { | ||
const res = parseConductorUrls('value1,value2 , value 3 , value4'); | ||
expect(res).toEqual(['value1', 'value2', 'value 3', 'value4']); | ||
}); | ||
it('removes trailing values properly', () => { | ||
const res1 = parseConductorUrls('value1,'); | ||
expect(res1).toEqual(['value1']); | ||
const res2 = parseConductorUrls('value1, '); | ||
expect(res2).toEqual(['value1']); | ||
}); | ||
it('handles malformed inputs such as just commas with spaces by falling through to default', () => { | ||
const res1 = parseConductorUrls(', ,, , , ,, , '); | ||
expect(res1).toEqual([DEFAULT_CONDUCTOR_URL]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters