Wire the test framework in to the demo tests
We're not exercising the test framework yet, but it's in place. Our democli expects its test assets to be in `./assets/bin`. We have a script `./scripts/download-binaries.sh` which will populate that directory from a google storage bucket. Once those assets are in place, you can run tests with `./scripts/run-tests.sh`.
This commit is contained in:
parent
1714b31d49
commit
8988075dad
|
|
@ -1 +1,2 @@
|
||||||
.idea
|
.idea
|
||||||
|
pkg/framework/test/assets/bin
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This directory will be the home of some binaries which are downloaded with `pkg/framework/test/scripts/download-binaries`.
|
||||||
|
|
@ -27,8 +27,8 @@ jobs:
|
||||||
export GOPATH="${PWD}/go"
|
export GOPATH="${PWD}/go"
|
||||||
export PATH="${PATH}:${GOPATH}/bin"
|
export PATH="${PATH}:${GOPATH}/bin"
|
||||||
go get github.com/onsi/ginkgo/ginkgo
|
go get github.com/onsi/ginkgo/ginkgo
|
||||||
cd "${GOPATH}/src/k8s.io/kubectl/pkg/framework/test"
|
"${GOPATH}/src/k8s.io/kubectl/pkg/framework/test/scripts/download-binaries.sh"
|
||||||
ginkgo -r
|
"${GOPATH}/src/k8s.io/kubectl/pkg/framework/test/scripts/run-tests.sh"
|
||||||
- name: push-to-prod-branch
|
- name: push-to-prod-branch
|
||||||
serial: true
|
serial: true
|
||||||
plan:
|
plan:
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,12 @@ import (
|
||||||
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/onsi/gomega/gexec"
|
"github.com/onsi/gomega/gexec"
|
||||||
|
"k8s.io/kubectl/pkg/framework/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIntegration(t *testing.T) {
|
func TestIntegration(t *testing.T) {
|
||||||
|
|
@ -16,14 +21,22 @@ func TestIntegration(t *testing.T) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
pathToDemoCommand string
|
pathToDemoCommand string
|
||||||
|
fixtures *test.Fixtures
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = BeforeSuite(func() {
|
var _ = BeforeSuite(func() {
|
||||||
var err error
|
var err error
|
||||||
pathToDemoCommand, err = gexec.Build("k8s.io/kubectl/pkg/framework/test/democli/")
|
pathToDemoCommand, err = gexec.Build("k8s.io/kubectl/pkg/framework/test/democli/")
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
|
assetsDir, ok := os.LookupEnv("KUBE_ASSETS_DIR")
|
||||||
|
Expect(ok).To(BeTrue(), "KUBE_ASSETS_DIR should point to a directory containing etcd and apiserver binaries")
|
||||||
|
fixtures = test.NewFixtures(filepath.Join(assetsDir, "etcd"), filepath.Join(assetsDir, "kube-apiserver"))
|
||||||
|
err = fixtures.Start()
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
|
fixtures.Stop()
|
||||||
gexec.CleanupBuildArtifacts()
|
gexec.CleanupBuildArtifacts()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Use DEBUG=1 ./scripts/download-binaries.sh to get debug output
|
||||||
|
quiet="--quiet"
|
||||||
|
[[ -z "${DEBUG:-""}" ]] || {
|
||||||
|
set -x
|
||||||
|
quiet=""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Use BASE_URL=https://my/binaries/url ./scripts/download-binaries to download
|
||||||
|
# from a different bucket
|
||||||
|
: "${BASE_URL:="https://storage.googleapis.com/k8s-c10s-test-binaries"}"
|
||||||
|
|
||||||
|
test_framework_dir="$(cd "$(dirname "$0")/.." ; pwd)"
|
||||||
|
os="$(uname -s)"
|
||||||
|
arch="$(uname -m)"
|
||||||
|
|
||||||
|
echo "About to download a couple of binaries. This might take a while..."
|
||||||
|
wget $quiet "${BASE_URL}/etcd-${os}-${arch}" -O "${test_framework_dir}/assets/bin/etcd"
|
||||||
|
wget $quiet "${BASE_URL}/kube-apiserver-${os}-${arch}" -O "${test_framework_dir}/assets/bin/kube-apiserver"
|
||||||
|
chmod +x "${test_framework_dir}/assets/bin/etcd"
|
||||||
|
chmod +x "${test_framework_dir}/assets/bin/kube-apiserver"
|
||||||
|
echo "Done!"
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Use DEBUG=1 ./scripts/run-tests.sh to get debug output
|
||||||
|
[[ -z "${DEBUG:-""}" ]] || set -x
|
||||||
|
|
||||||
|
ginkgo_args=''
|
||||||
|
[[ -z "${GINKGO_WATCH:-""}" ]] || ginkgo_args="${ginkgo_args} watch"
|
||||||
|
|
||||||
|
test_framework_dir="$(cd "$(dirname "$0")/.." ; pwd)"
|
||||||
|
|
||||||
|
export KUBE_ASSETS_DIR="${test_framework_dir}/assets/bin"
|
||||||
|
|
||||||
|
ginkgo $ginkgo_args -r "${test_framework_dir}"
|
||||||
Loading…
Reference in New Issue