Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Caleb Schoepp <[email protected]>
  • Loading branch information
calebschoepp committed Sep 12, 2024
1 parent 622bee1 commit 939f591
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion e2e/spintainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestSpintainer(t *testing.T) {
var client klient.Client

helloWorldImage := "ghcr.io/spinkube/spin-operator/hello-world:20240708-130250-gfefd2b1"
testSpinAppName := "test-spinapp"
testSpinAppName := "test-spintainer-app"

defaultTest := features.New("default and most minimal setup").
Setup(func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
Expand Down
12 changes: 11 additions & 1 deletion internal/controller/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"

spinv1alpha1 "github.com/spinkube/spin-operator/api/v1alpha1"
"github.com/spinkube/spin-operator/internal/generics"
"github.com/spinkube/spin-operator/pkg/spinapp"
)

Expand Down Expand Up @@ -280,7 +281,16 @@ func TestSpinHealthCheckToCoreProbe(t *testing.T) {
func TestDeploymentLabel(t *testing.T) {
scheme := registerAndGetScheme()
app := minimalSpinApp()
deployment, err := constructDeployment(context.Background(), app, &spinv1alpha1.ExecutorDeploymentConfig{}, "", "", scheme)
deployment, err := constructDeployment(
context.Background(),
app,
&spinv1alpha1.ExecutorDeploymentConfig{
RuntimeClassName: generics.Ptr("containerd-shim-spin"),
},
"",
"",
scheme,
)

require.Nil(t, err)
require.NotNil(t, deployment.ObjectMeta.Labels)
Expand Down
4 changes: 4 additions & 0 deletions internal/webhook/spinappexecutor_validating.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func (v *SpinAppExecutorValidator) validateSpinAppExecutor(executor *spinv1alpha
}

func validateRuntimeClassAndSpinImage(spec *spinv1alpha1.SpinAppExecutorSpec) *field.Error {
if spec.DeploymentConfig == nil {
return nil
}

if spec.DeploymentConfig.RuntimeClassName != nil && spec.DeploymentConfig.SpinImage != nil {
return field.Invalid(field.NewPath("spec").Child("deploymentConfig").Child("runtimeClassName"), spec.DeploymentConfig.RuntimeClassName,
"runtimeClassName and spinImage are mutually exclusive")
Expand Down

0 comments on commit 939f591

Please sign in to comment.