Commit 4e0c205
fix: Change the labels to an array (#881)
This pull request introduces changes to improve type consistency,
enhance test coverage, and refactor the `Handler` method in the
`OperatorGenerator` class for better dependency injection. Below is a
summary of the most important changes:
### Type Consistency Improvements:
* Changed the `Labels` property in `KustomizationConfig` from
`KustomizationCommonLabels?` to an array type
`KustomizationCommonLabels[]?` to allow multiple labels.
(`src/KubeOps.Abstractions/Kustomize/KustomizationConfig.cs`)
* Updated the `Labels` assignment in the `Handler` method to use array
initialization syntax for consistency with the new type.
(`src/KubeOps.Cli/Commands/Generator/OperatorGenerator.cs`)
### Refactoring for Dependency Injection:
* Refactored the `Handler` method in `OperatorGenerator` to inject
`IAnsiConsole` as a parameter instead of directly using
`AnsiConsole.Console`. This improves testability and decouples the
method from the static console instance.
(`src/KubeOps.Cli/Commands/Generator/OperatorGenerator.cs`)
[[1]](diffhunk://#diff-cf95f5a9676479797ff0ade11e4dd8d679dd1974142058976f3a35ca6a63b4f2L39-R45)
[[2]](diffhunk://#diff-cf95f5a9676479797ff0ade11e4dd8d679dd1974142058976f3a35ca6a63b4f2L54-R62)
[[3]](diffhunk://#diff-cf95f5a9676479797ff0ade11e4dd8d679dd1974142058976f3a35ca6a63b4f2L74-R109)
[[4]](diffhunk://#diff-cf95f5a9676479797ff0ade11e4dd8d679dd1974142058976f3a35ca6a63b4f2L159-R159)
[[5]](diffhunk://#diff-cf95f5a9676479797ff0ade11e4dd8d679dd1974142058976f3a35ca6a63b4f2L170-R174)
### Test Coverage Enhancements:
* Added a new integration test
`Should_Generate_Valid_Installers_In_Cluster` to validate the generated
Kubernetes YAML files and ensure the presence of a valid
`kustomization.yaml` file.
(`test/KubeOps.Cli.Test/Management/Install.Integration.Test.cs`)
* Improved test dependencies by including `FluentAssertions` for better
assertions and validation in test cases.
(`test/KubeOps.Cli.Test/Management/Install.Integration.Test.cs`)
These changes improve the maintainability, testability, and
functionality of the codebase.
---------
Co-authored-by: Christoph Bühler <[email protected]>1 parent 74c0a66 commit 4e0c205
File tree
3 files changed
+81
-24
lines changed- src
- KubeOps.Abstractions/Kustomize
- KubeOps.Cli/Commands/Generator
- test/KubeOps.Cli.Test/Management
3 files changed
+81
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
Lines changed: 59 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| |||
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | | - | |
19 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| |||
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
30 | 87 | | |
0 commit comments