From 7e8965b3ba1056b137e3e0f86a81cba3fb60fd1d Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Thu, 17 May 2018 09:25:17 +0100 Subject: [PATCH] experimenting with the kubernetes integration testing framework --- pkg/config/config_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 1ed16fb6a..eff35b25e 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -1,10 +1,13 @@ package config_test import ( + "os" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "sigs.k8s.io/testing_frameworks/integration" "github.com/jetstack/navigator/internal/test/util/testfs" "github.com/jetstack/navigator/pkg/config" @@ -27,3 +30,24 @@ func TestRoundTrip(t *testing.T) { assert.Equal(t, c1.AllSettings(), c2.AllSettings()) } + +func TestIntegration(t *testing.T) { + cp := &integration.ControlPlane{ + APIServer: &integration.APIServer{ + Out: os.Stdout, + Err: os.Stderr, + }, + } + err := cp.Start() + require.NoError(t, err) + defer cp.Stop() + t.Log(cp.APIURL()) + kubeCtl := cp.KubeCtl() + stdout, stderr, err := kubeCtl.Run("get", "ns") + require.NoError(t, err) + // You can check on err, stdout & stderr and build up + // your tests + t.Log("out", stdout) + t.Log("err", stderr) + time.Sleep(time.Hour) +}