mirror of
https://github.com/rancher/k3k.git
synced 2026-08-18 03:46:31 +00:00
- Removed K3s container setup and teardown logic from CLI and E2E test suites. - Simplified Kubernetes client initialization by eliminating the need for K3s container. - Updated InitFromKubeconfig function to no longer require K3s container as a parameter. - Deleted unused HelmInstaller and RESTClientGetter implementations. - Cleaned up logging functions related to K3s and Helm operations.
50 lines
904 B
Go
50 lines
904 B
Go
package cli_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"k8s.io/client-go/kubernetes"
|
|
"k8s.io/client-go/rest"
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
|
|
fwclient "github.com/rancher/k3k/tests/framework/client"
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
const (
|
|
k3kNamespace = "k3k-system"
|
|
|
|
k3sVersion = "v1.35.2-k3s1"
|
|
k3sOldVersion = "v1.35.0-k3s1"
|
|
)
|
|
|
|
func TestTests(t *testing.T) {
|
|
RegisterFailHandler(Fail)
|
|
RunSpecs(t, "Tests Suite")
|
|
}
|
|
|
|
var (
|
|
restcfg *rest.Config
|
|
k8s *kubernetes.Clientset
|
|
k8sClient client.Client
|
|
)
|
|
|
|
var _ = BeforeSuite(func() {
|
|
ctx := context.Background()
|
|
|
|
initKubernetesClient(ctx)
|
|
})
|
|
|
|
func initKubernetesClient(ctx context.Context) {
|
|
scheme := fwclient.NewScheme()
|
|
config, err := fwclient.InitFromKubeconfig(ctx, scheme)
|
|
Expect(err).NotTo(HaveOccurred())
|
|
|
|
restcfg = config.RestConfig
|
|
k8s = config.Clientset
|
|
k8sClient = config.Client
|
|
}
|