Skip to content

A Go library that provides extensions to github.com/kubernetes-sigs/e2e-framework to implement end-to-end tests for kubernetes APIs.

Notifications You must be signed in to change notification settings

dbinfrago/kubernetes-e2e-test-framework

Repository files navigation

Kubernetes E2E Test Framework

A Go library that provides extensions to github.com/kubernetes-sigs/e2e-framework to implement end-to-end tests for kubernetes APIs.

Usage

Use it like so to apply crossplane claims to your cluster and make assertions on it:

package coolfeature

import (
	"context"
	"testing"
	"time"

	crossplanefeatures "github.com/dbinfrago/kubernetes-e2e-test-framework/crossplane/features"
	e2efeatures "github.com/dbinfrago/kubernetes-e2e-test-framework/features"
	"sigs.k8s.io/e2e-framework/pkg/envconf"
	"sigs.k8s.io/e2e-framework/pkg/features"
)

func FeatureTest(t *testing.T) {
	crossplaneClaim := LoadClaimFromYaml(`apiVersion: ...`)

	features.New("Cool Feature").
		Setup(e2efeatures.ApplyObject(crossplaneClaim)).
		Assess("await claim", crossplanefeatures.WaitForClaimReady(crossplaneClaim, 5*time.Minute)).
		Assess("check claim status", e2efeatures.Assess(func(ctx context.Context, t *testing.T, cfg *envconf.Config) error {
			kube := cfg.Client()
			// Use kube client to check that your claim produces the correct managed resources.

			return nil
		})).
		Assess("delete claim", crossplanefeatures.DeleteClaim(crossplaneClaim, 5*time.Minute))
}

Contributing

See our Contributing Guidelines.

Licensing

Each file contains a license reference to one of the included licenses.

About

A Go library that provides extensions to github.com/kubernetes-sigs/e2e-framework to implement end-to-end tests for kubernetes APIs.

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages