|
|
|
@ -1,21 +1,23 @@
|
|
|
|
|
package integration
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
v1 "k8s.io/api/core/v1"
|
|
|
|
|
|
|
|
|
|
testutil "github.com/k3s-io/k3s/tests/integration"
|
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
|
. "github.com/onsi/gomega/gstruct"
|
|
|
|
|
v1 "k8s.io/api/core/v1"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var startupServer *testutil.K3sServer
|
|
|
|
|
var startupServerArgs = []string{}
|
|
|
|
|
var testLock int
|
|
|
|
|
var (
|
|
|
|
|
startupServer *testutil.K3sServer
|
|
|
|
|
startupServerArgs = []string{}
|
|
|
|
|
testLock int
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var _ = BeforeSuite(func() {
|
|
|
|
|
if testutil.IsExistingServer() {
|
|
|
|
@ -27,7 +29,6 @@ var _ = BeforeSuite(func() {
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
var _ = Describe("startup tests", Ordered, func() {
|
|
|
|
|
|
|
|
|
|
When("a default server is created", func() {
|
|
|
|
|
It("is created with no arguments", func() {
|
|
|
|
|
var err error
|
|
|
|
@ -263,7 +264,54 @@ var _ = Describe("startup tests", Ordered, func() {
|
|
|
|
|
Expect(testutil.K3sCleanup(-1, "")).To(Succeed())
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
When("a server with datastore-endpoint and disable apiserver is created", func() {
|
|
|
|
|
It("is created with datastore-endpoint and disable apiserver flags", func() {
|
|
|
|
|
var err error
|
|
|
|
|
startupServerArgs = []string{"--datastore-endpoint", "test", "--disable-apiserver"}
|
|
|
|
|
startupServer, err = testutil.K3sStartServer(startupServerArgs...)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
})
|
|
|
|
|
It("search for the error log", func() {
|
|
|
|
|
Eventually(func() error {
|
|
|
|
|
match, err := testutil.SearchK3sLog(startupServer, "invalid flag use; cannot use --disable-apiserver with --datastore-endpoint")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
if match {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return errors.New("nor found error when --datastore-endpoint and --disable-apiserver are used together")
|
|
|
|
|
}, "30s", "2s").Should(Succeed())
|
|
|
|
|
})
|
|
|
|
|
It("cleans up", func() {
|
|
|
|
|
Expect(testutil.K3sKillServer(startupServer)).To(Succeed())
|
|
|
|
|
Expect(testutil.K3sCleanup(-1, "")).To(Succeed())
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
When("a server with datastore-endpoint and disable etcd is created", func() {
|
|
|
|
|
It("is created with datastore-endpoint and disable etcd flags", func() {
|
|
|
|
|
var err error
|
|
|
|
|
startupServerArgs = []string{"--datastore-endpoint", "test", "--disable-etcd", "-s", "https://192.168.1.12:6443"}
|
|
|
|
|
startupServer, err = testutil.K3sStartServer(startupServerArgs...)
|
|
|
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
|
})
|
|
|
|
|
It("search for the error log", func() {
|
|
|
|
|
Eventually(func() error {
|
|
|
|
|
match, err := testutil.SearchK3sLog(startupServer, "invalid flag use; cannot use --disable-etcd with --datastore-endpoint")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
if match {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return errors.New("not found error when --datastore-endpoint and --disable-etcd are used together")
|
|
|
|
|
}, "30s", "2s").Should(Succeed())
|
|
|
|
|
})
|
|
|
|
|
It("cleans up", func() {
|
|
|
|
|
Expect(testutil.K3sKillServer(startupServer)).To(Succeed())
|
|
|
|
|
Expect(testutil.K3sCleanup(-1, "")).To(Succeed())
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
var failed bool
|
|
|
|
|