-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract component versions to a static file
This should make it easier to add new components, or change versions. Embed the file into the binary with Go Embed. Signed-off-by: David Calavera <dcalaverapalacio@twilio.com>
- Loading branch information
David Calavera
committed
Aug 11, 2021
1 parent
302224c
commit 828bacc
Showing
3 changed files
with
108 additions
and
20 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,55 @@ | ||
package cmd | ||
|
||
import "testing" | ||
|
||
func TestGetRequiredVersions(t *testing.T) { | ||
cases := Services{ | ||
{ | ||
Name: "cert-manager", | ||
Version: "1.4.0", | ||
}, | ||
{ | ||
Name: "coredns", | ||
Version: "1.8.4", | ||
}, | ||
{ | ||
Name: "kube-proxy", | ||
Version: "1.19.6-eksbuild.2", | ||
}, | ||
{ | ||
Name: "kube-state-metrics", | ||
Version: "2.1.0", | ||
}, | ||
{ | ||
Name: "metrics-server", | ||
Version: "0.5.0", | ||
}, | ||
{ | ||
Name: "node-problem-detector", | ||
Version: "0.8.9", | ||
}, | ||
{ | ||
Name: "nvidia-device-plugin", | ||
Version: "0.9.0", | ||
}, | ||
{ | ||
Name: "cluster-autoscaler", | ||
Version: "1.19", | ||
}, | ||
} | ||
|
||
for _, test := range cases { | ||
actual, err := getRequiredVersion("v1.19", test.Name) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
assertVersion(t, test.Name, test.Version, actual) | ||
} | ||
} | ||
|
||
func assertVersion(t *testing.T, component, expected, actual string) { | ||
t.Helper() | ||
if expected != actual { | ||
t.Fatalf("expected %s version %s, got %s", component, expected, actual) | ||
} | ||
} |
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,36 @@ | ||
{ | ||
"v1.19": [ | ||
{ | ||
"Name": "cert-manager", | ||
"Version": "1.4.0" | ||
}, | ||
{ | ||
"Name": "coredns", | ||
"Version": "1.8.4" | ||
}, | ||
{ | ||
"Name": "kube-proxy", | ||
"Version": "1.19.6-eksbuild.2" | ||
}, | ||
{ | ||
"Name": "kube-state-metrics", | ||
"Version": "2.1.0" | ||
}, | ||
{ | ||
"Name": "metrics-server", | ||
"Version": "0.5.0" | ||
}, | ||
{ | ||
"Name": "node-problem-detector", | ||
"Version": "0.8.9" | ||
}, | ||
{ | ||
"Name": "nvidia-device-plugin", | ||
"Version": "0.9.0" | ||
}, | ||
{ | ||
"Name": "cluster-autoscaler", | ||
"Version": "1.19" | ||
} | ||
] | ||
} |