mirror of
https://github.com/YuzuZensai/Minikura.git
synced 2026-09-13 10:49:21 +00:00
🐛 fix: harden operator reconciliation and install
This commit is contained in:
@@ -195,6 +195,9 @@ func TestMinecraftAPIKeyAndOptionalEnv(t *testing.T) {
|
||||
if e.ValueFrom.SecretKeyRef.Name != "minikura-key" || e.ValueFrom.SecretKeyRef.Key != "api-key" {
|
||||
t.Errorf("secret ref = %+v", e.ValueFrom.SecretKeyRef)
|
||||
}
|
||||
if e.ValueFrom.SecretKeyRef.Optional != nil {
|
||||
t.Error("API key Secret must be required")
|
||||
}
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
@@ -202,6 +205,21 @@ func TestMinecraftAPIKeyAndOptionalEnv(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMinecraftProtectedEnvCannotBeOverridden(t *testing.T) {
|
||||
mc := testServer()
|
||||
mc.Spec.APIKeySecretRef = "minikura-key"
|
||||
mc.Spec.Env = []v1alpha1.EnvVar{{Name: "EULA", Value: "FALSE"}, {Name: "MINIKURA_API_KEY", Value: "inline"}}
|
||||
env := minecraftEnv(mc)
|
||||
if got, _ := envValue(env, "EULA"); got != "TRUE" {
|
||||
t.Errorf("EULA = %q", got)
|
||||
}
|
||||
for _, item := range env {
|
||||
if item.Name == "MINIKURA_API_KEY" && (item.ValueFrom == nil || item.ValueFrom.SecretKeyRef == nil) {
|
||||
t.Error("API key secret reference was overridden")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatefulSetDefaultStorage(t *testing.T) {
|
||||
mc := testServer()
|
||||
mc.Spec.StorageSize = ""
|
||||
|
||||
Reference in New Issue
Block a user