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

DSD-DBS/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 (
	"testing"
	"time"
	
	"sigs.k8s.io/e2e-framework/pkg/features"
	e2efeatures "github.com/dsd-dbs/kubernetes-e2e-test-framework/features"
	crossplanefeatures "github.com/dsd-dbs/kubernetes-e2e-test-framework/crossplane/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.Minutes))
	.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.Minutes))
}

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

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages