Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Add test framework (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt authored Nov 22, 2019
1 parent 619f757 commit 6a9f128
Show file tree
Hide file tree
Showing 3 changed files with 1,801 additions and 0 deletions.
94 changes: 94 additions & 0 deletions test/addons_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package test

import (
"testing"

"github.com/blang/semver"

"github.com/mesosphere/kubeaddons/api/v1beta1"
"github.com/mesosphere/kubeaddons/hack/temp"
"github.com/mesosphere/kubeaddons/pkg/test"
"github.com/mesosphere/kubeaddons/pkg/test/cluster/kind"
)

var environmentConciousFilteredAddons = []string{
"awsebscsiprovisioner",
"awsebsprovisioner",
"azuredisk-csi-driver",
"azurediskprovisioner",
"konvoyconfig",
"localvolumeprovisioner",
"metallb",
"nvidia",
}

// TODO - only doing a couple of addons for the moment, this will be expanded upon in later iterations
// after we've worked out some of the issues with the testing environment and addon requirements.
var temporarilyFilteredAddons = []string{
"cert-manager",
"defaultstorageclass-protection",
"dex-k8s-authenticator",
"dex",
"dispatch",
"elasticsearchexporter",
"elasticsearch",
"external-dns",
"flagger",
"fluentbit",
"gatekeeper",
"istio",
"kibana",
"kommander",
"kube-oidc-proxy",
"opsportal",
"prometheusadapter",
"prometheus",
"reloader",
"traefik-forward-auth",
"traefik",
"velero",
"kudo",
}

// TestAddons tests deployment of all addons in this repository
func TestAddons(t *testing.T) {
cluster, err := kind.NewCluster(semver.MustParse("1.15.6"))
if err != nil {
t.Fatal(err)
}
defer cluster.Cleanup()

if err := temp.DeployController(cluster); err != nil {
t.Fatal(err)
}

addons, err := temp.Addons("../templates/")
if err != nil {
t.Fatal(err)
}

testAddons := []v1beta1.AddonInterface{}
for _, v := range addons {
isFiltered := false
for _, filtered := range append(temporarilyFilteredAddons, environmentConciousFilteredAddons...) {
if v[0].GetName() == filtered {
isFiltered = true
}
}
if !isFiltered {
// TODO - for right now, we're only testing the latest revision.
// We're waiting on additional features from the test harness to
// expand this, see https://jira.mesosphere.com/browse/DCOS-61266
testAddons = append(testAddons, v[0])
}
}

th, err := test.NewBasicTestHarness(t, cluster, testAddons...)
if err != nil {
t.Fatal(err)
}
defer th.Cleanup()

th.Validate()
th.Deploy()
}
27 changes: 27 additions & 0 deletions test/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module github.com/mesosphere/kubeaddons-configs/test

go 1.13

require (
github.com/blang/semver v3.5.1+incompatible
github.com/emicklei/go-restful v2.11.1+incompatible // indirect
github.com/go-openapi/spec v0.19.4 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/mesosphere/kubeaddons v0.5.4-0.20191122175928-ab87ea3a1c0a
go.uber.org/atomic v1.5.1 // indirect
go.uber.org/multierr v1.4.0 // indirect
go.uber.org/zap v1.13.0 // indirect
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba // indirect
golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914 // indirect
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/tools v0.0.0-20191122161556-0ae87fff1b85 // indirect
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 // indirect
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/yaml.v2 v2.2.7 // indirect
k8s.io/apiextensions-apiserver v0.0.0-20191121021419-88daf26ec3b8 // indirect
k8s.io/utils v0.0.0-20191114200735-6ca3b61696b6 // indirect
sigs.k8s.io/controller-runtime v0.4.0 // indirect
)

replace k8s.io/client-go => k8s.io/client-go v0.0.0-20191114101535-6c5935290e33
Loading

0 comments on commit 6a9f128

Please sign in to comment.