-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2.9]GKE - allow initial node count to be 0 (#11862)
* fix gke node pool count validation and event emitting from the gkenodepool component * update gke node count validation and refactor to enable unit tests * revert vue3 syntax change from cherry pick
- Loading branch information
1 parent
d305d0b
commit 9d6d98b
Showing
4 changed files
with
63 additions
and
17 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
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,42 @@ | ||
import { GKEInitialCount } from '../validators'; | ||
|
||
const mockTranslation = (key: string) => key; | ||
|
||
describe('validate GKE node group initial count', () => { | ||
it.each([ | ||
[-1, 'gke.errors.initialNodeCount'], | ||
[0, null], | ||
[2, null], | ||
[1000, null], | ||
[1001, 'gke.errors.initialNodeCount'] | ||
])('should return an error if the initial node count is less than 0 or greater than 1000', (count, errMsg) => { | ||
const ctx = { | ||
config: { }, | ||
t: mockTranslation, | ||
isAuthenticated: true | ||
} as any; | ||
|
||
const res = GKEInitialCount(ctx)(count); | ||
|
||
expect(res).toBe(errMsg); | ||
}); | ||
|
||
it.each([ | ||
[[{ initialNodeCount: -1 }], 'gke.errors.initialNodeCount'], | ||
[[{ initialNodeCount: 0 }, { initialNodeCount: 1 }], null], | ||
[[{ initialNodeCount: 1000 }, { initialNodeCount: 1 }], null], | ||
[[{ initialNodeCount: 1001 }, { initialNodeCount: 1 }], 'gke.errors.initialNodeCount'] | ||
|
||
])('should validate each node group in the component context if not called with a specific count value', (nodePools, errMsg) => { | ||
const ctx = { | ||
config: { }, | ||
t: mockTranslation, | ||
nodePools, | ||
isAuthenticated: true | ||
} as any; | ||
|
||
const res = GKEInitialCount(ctx)(); | ||
|
||
expect(res).toBe(errMsg); | ||
}); | ||
}); |
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