-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1278 from loft-sh/thomaskosiewski/eng-2164-vclust…
…er-connect-no-longer-allows-passing-commands-with Fixed use command expecting only one arg
- Loading branch information
Showing
13 changed files
with
126 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package connect | ||
|
||
import ( | ||
"os" | ||
"strings" | ||
|
||
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd" | ||
"github.com/loft-sh/vcluster/cmd/vclusterctl/flags" | ||
"github.com/loft-sh/vcluster/test/framework" | ||
"github.com/onsi/ginkgo/v2" | ||
) | ||
|
||
var _ = ginkgo.Describe("Connect to vCluster", func() { | ||
f := framework.DefaultFramework | ||
|
||
ginkgo.BeforeEach(func() { | ||
disconnectCmd := cmd.NewDisconnectCmd(&flags.GlobalFlags{}) | ||
disconnectCmd.SetArgs([]string{}) | ||
|
||
err := disconnectCmd.Execute() | ||
if err != nil && !strings.Contains(err.Error(), "not a vcluster context") { | ||
framework.ExpectNoError(err) | ||
} | ||
}) | ||
|
||
ginkgo.It("should connect to an OSS vcluster", func() { | ||
kcfgFile, err := os.CreateTemp("", "kubeconfig") | ||
framework.ExpectNoError(err) | ||
|
||
connectCmd := cmd.NewConnectCmd(&flags.GlobalFlags{}) | ||
|
||
err = connectCmd.Flags().Set("kube-config", kcfgFile.Name()) | ||
framework.ExpectNoError(err) | ||
|
||
connectCmd.SetArgs([]string{f.VclusterName}) | ||
|
||
err = connectCmd.Execute() | ||
framework.ExpectNoError(err) | ||
}) | ||
|
||
ginkgo.It("should connect to an OSS vcluster and execute a command", func() { | ||
connectCmd := cmd.NewConnectCmd(&flags.GlobalFlags{}) | ||
connectCmd.SetArgs([]string{f.VclusterName, "--", "kubectl", "get", "ns"}) | ||
|
||
err := connectCmd.Execute() | ||
framework.ExpectNoError(err) | ||
}) | ||
}) |
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,44 @@ | ||
package e2ecli | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/loft-sh/log" | ||
"github.com/loft-sh/vcluster/test/framework" | ||
"github.com/onsi/ginkgo/v2" | ||
"github.com/onsi/gomega" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
clientgoscheme "k8s.io/client-go/kubernetes/scheme" | ||
|
||
// Enable cloud provider auth | ||
_ "k8s.io/client-go/plugin/pkg/client/auth" | ||
|
||
// Register tests | ||
_ "github.com/loft-sh/vcluster/test/e2e_cli/connect" | ||
) | ||
|
||
var ( | ||
scheme = runtime.NewScheme() | ||
) | ||
|
||
func init() { | ||
_ = clientgoscheme.AddToScheme(scheme) | ||
} | ||
|
||
func TestRunE2ETests(t *testing.T) { | ||
gomega.RegisterFailHandler(ginkgo.Fail) | ||
err := framework.CreateFramework(context.Background(), scheme) | ||
if err != nil { | ||
log.GetInstance().Fatalf("Error setting up framework: %v", err) | ||
} | ||
|
||
var _ = ginkgo.AfterSuite(func() { | ||
err = framework.DefaultFramework.Cleanup() | ||
if err != nil { | ||
log.GetInstance().Warnf("Error executing testsuite cleanup: %v", err) | ||
} | ||
}) | ||
|
||
ginkgo.RunSpecs(t, "Vcluster CLI e2e suite") | ||
} |
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,3 @@ | ||
# empty values file to avoid no file or dir error | ||
# this test suite will be run for all configurations | ||
# so add values for this test suite in commonValues.yaml |
2 changes: 1 addition & 1 deletion
2
vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/get/secret.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/set/secret.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/use/space.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/use/vcluster.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 17 additions & 13 deletions
30
vendor/github.com/loft-sh/loftctl/v3/pkg/util/positional_args.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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