-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(integration): Add scaffold for running integration tests
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
- Loading branch information
1 parent
a0ad1ad
commit dc33fab
Showing
8 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package integration_tests | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestIntegration(t *testing.T) { | ||
if testing.Short() { | ||
t.Skip("Skipping integration test") | ||
} | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Starboard CLI") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package integration_tests | ||
|
||
import ( | ||
"context" | ||
extensionsapi "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" | ||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/client-go/kubernetes" | ||
"k8s.io/client-go/tools/clientcmd" | ||
"os" | ||
"os/exec" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
const ( | ||
starboardCmd = "./../bin/starboard" | ||
) | ||
|
||
var _ = Describe("Starboard CLI", func() { | ||
|
||
BeforeEach(func() { | ||
// setup | ||
}) | ||
|
||
Describe("Version command", func() { | ||
It("Should print the current version of the Starboard CLI", func() { | ||
cmd := exec.Command(starboardCmd, []string{"version"}...) | ||
output, err := cmd.Output() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(string(output)).To(Equal("Starboard Version: {Version:dev Commit:none Date:unknown}\n")) | ||
}) | ||
|
||
}) | ||
|
||
Describe("Init command", func() { | ||
It("Should initialize Starboard", func() { | ||
cmd := exec.Command(starboardCmd, []string{"init", "-v", "3"}...) | ||
_, err := cmd.Output() | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
|
||
// use the current context in kubeconfig | ||
config, err := clientcmd.BuildConfigFromFlags("", os.Getenv("KUBECONFIG")) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
|
||
// create the clientset | ||
clientset, err := kubernetes.NewForConfig(config) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(clientset).ShouldNot(Equal(nil)) | ||
|
||
clientsetext, err := extensionsapi.NewForConfig(config) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
crdsList, err := clientsetext.CustomResourceDefinitions().List(context.Background(), v1.ListOptions{}) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
Expect(len(crdsList.Items)).To(Equal(4)) | ||
}) | ||
}) | ||
|
||
AfterEach(func() { | ||
// tear down | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters