mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-02 19:25:51 +00:00
test: restructed setup and added scripting for infisical init
This commit is contained in:
+2
-2
@@ -3,7 +3,9 @@ module github.com/Infisical/infisical-merge
|
|||||||
go 1.21
|
go 1.21
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/bradleyjkemp/cupaloy/v2 v2.8.0
|
||||||
github.com/charmbracelet/lipgloss v0.5.0
|
github.com/charmbracelet/lipgloss v0.5.0
|
||||||
|
github.com/creack/pty v1.1.21
|
||||||
github.com/denisbrodbeck/machineid v1.0.1
|
github.com/denisbrodbeck/machineid v1.0.1
|
||||||
github.com/fatih/semgroup v1.2.0
|
github.com/fatih/semgroup v1.2.0
|
||||||
github.com/gitleaks/go-gitdiff v0.8.0
|
github.com/gitleaks/go-gitdiff v0.8.0
|
||||||
@@ -29,9 +31,7 @@ require (
|
|||||||
require (
|
require (
|
||||||
github.com/alessio/shellescape v1.4.1 // indirect
|
github.com/alessio/shellescape v1.4.1 // indirect
|
||||||
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
|
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
|
||||||
github.com/bradleyjkemp/cupaloy/v2 v2.8.0 // indirect
|
|
||||||
github.com/chzyer/readline v1.5.1 // indirect
|
github.com/chzyer/readline v1.5.1 // indirect
|
||||||
github.com/creack/pty v1.1.21 // indirect
|
|
||||||
github.com/danieljoos/wincred v1.2.0 // indirect
|
github.com/danieljoos/wincred v1.2.0 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
|
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
|
|
||||||
func TestUniversalAuth_ExportSecretsWithImports(t *testing.T) {
|
func TestUniversalAuth_ExportSecretsWithImports(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent")
|
||||||
|
|
||||||
@@ -24,8 +23,6 @@ func TestUniversalAuth_ExportSecretsWithImports(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceToken_ExportSecretsWithImports(t *testing.T) {
|
func TestServiceToken_ExportSecretsWithImports(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -41,8 +38,6 @@ func TestServiceToken_ExportSecretsWithImports(t *testing.T) {
|
|||||||
|
|
||||||
func TestUniversalAuth_ExportSecretsWithoutImports(t *testing.T) {
|
func TestUniversalAuth_ExportSecretsWithoutImports(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -57,8 +52,6 @@ func TestUniversalAuth_ExportSecretsWithoutImports(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceToken_ExportSecretsWithoutImports(t *testing.T) {
|
func TestServiceToken_ExportSecretsWithoutImports(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "export", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+3
-3
@@ -2,10 +2,10 @@ package tests
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -48,7 +48,7 @@ func ExecuteCliCommand(command string, args ...string) (string, error) {
|
|||||||
return strings.TrimSpace(string(output)), nil
|
return strings.TrimSpace(string(output)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetupCli(t *testing.T) {
|
func SetupCli() {
|
||||||
|
|
||||||
if creds.ClientID == "" || creds.ClientSecret == "" || creds.ServiceToken == "" || creds.ProjectID == "" || creds.EnvSlug == "" {
|
if creds.ClientID == "" || creds.ClientSecret == "" || creds.ServiceToken == "" || creds.ProjectID == "" || creds.EnvSlug == "" {
|
||||||
panic("Missing required environment variables")
|
panic("Missing required environment variables")
|
||||||
@@ -62,7 +62,7 @@ func SetupCli(t *testing.T) {
|
|||||||
|
|
||||||
if !alreadyBuilt {
|
if !alreadyBuilt {
|
||||||
if err := exec.Command("go", "build", "../.").Run(); err != nil {
|
if err := exec.Command("go", "build", "../.").Run(); err != nil {
|
||||||
t.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+47
-6
@@ -1,6 +1,8 @@
|
|||||||
package tests
|
package tests
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -9,21 +11,62 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UserLoginCmd(t *testing.T) {
|
func UserInitCmd() {
|
||||||
SetupCli(t)
|
c := exec.Command(FORMATTED_CLI_NAME, "init")
|
||||||
|
ptmx, err := pty.Start(c)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("error running CLI command: %v", err)
|
||||||
|
}
|
||||||
|
defer func() { _ = ptmx.Close() }()
|
||||||
|
|
||||||
|
stepChan := make(chan int, 10)
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
buf := make([]byte, 1024)
|
||||||
|
step := -1
|
||||||
|
for {
|
||||||
|
n, err := ptmx.Read(buf)
|
||||||
|
if n > 0 {
|
||||||
|
terminalOut := string(buf)
|
||||||
|
fmt.Println("Terminal out is", terminalOut)
|
||||||
|
if strings.Contains(terminalOut, "Which Infisical organization would you like to select a project from?") && step < 0 {
|
||||||
|
step += 1
|
||||||
|
stepChan <- step
|
||||||
|
} else if strings.Contains(terminalOut, "Which of your Infisical projects would you like to connect this project to?") && step < 1 {
|
||||||
|
step += 1;
|
||||||
|
stepChan <- step
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
close(stepChan)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
for i := range stepChan {
|
||||||
|
switch i {
|
||||||
|
case 0:
|
||||||
|
ptmx.Write([]byte("\n"))
|
||||||
|
case 1:
|
||||||
|
ptmx.Write([]byte("\n"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func UserLoginCmd() {
|
||||||
// set vault to file because CI has no keyring
|
// set vault to file because CI has no keyring
|
||||||
vaultCmd := exec.Command(FORMATTED_CLI_NAME, "vault", "set", "file")
|
vaultCmd := exec.Command(FORMATTED_CLI_NAME, "vault", "set", "file")
|
||||||
_, err := vaultCmd.Output()
|
_, err := vaultCmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error setting vault: %v", err)
|
log.Fatalf("error setting vault: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start programmatic interaction with CLI
|
// Start programmatic interaction with CLI
|
||||||
c := exec.Command(FORMATTED_CLI_NAME, "login", "--interactive")
|
c := exec.Command(FORMATTED_CLI_NAME, "login", "--interactive")
|
||||||
ptmx, err := pty.Start(c)
|
ptmx, err := pty.Start(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error running CLI command: %v", err)
|
log.Fatalf("error running CLI command: %v", err)
|
||||||
}
|
}
|
||||||
defer func() { _ = ptmx.Close() }()
|
defer func() { _ = ptmx.Close() }()
|
||||||
|
|
||||||
@@ -83,8 +126,6 @@ func UserLoginCmd(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func MachineIdentityLoginCmd(t *testing.T) {
|
func MachineIdentityLoginCmd(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
if creds.UAAccessToken != "" {
|
if creds.UAAccessToken != "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package tests
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMain(m *testing.M) {
|
||||||
|
// Setup
|
||||||
|
fmt.Println("Setting up CLI...")
|
||||||
|
SetupCli()
|
||||||
|
fmt.Println("Performing user login...")
|
||||||
|
UserLoginCmd()
|
||||||
|
fmt.Println("Performing infisical init...")
|
||||||
|
UserInitCmd()
|
||||||
|
|
||||||
|
// Run the tests
|
||||||
|
code := m.Run()
|
||||||
|
|
||||||
|
// Exit
|
||||||
|
os.Exit(code)
|
||||||
|
}
|
||||||
@@ -8,8 +8,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestServiceToken_RunCmdRecursiveAndImports(t *testing.T) {
|
func TestServiceToken_RunCmdRecursiveAndImports(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent", "--", "echo", "hello world")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent", "--", "echo", "hello world")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -25,8 +23,6 @@ func TestServiceToken_RunCmdRecursiveAndImports(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func TestServiceToken_RunCmdWithImports(t *testing.T) {
|
func TestServiceToken_RunCmdWithImports(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--", "echo", "hello world")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--", "echo", "hello world")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -44,8 +40,6 @@ func TestServiceToken_RunCmdWithImports(t *testing.T) {
|
|||||||
|
|
||||||
func TestUniversalAuth_RunCmdRecursiveAndImports(t *testing.T) {
|
func TestUniversalAuth_RunCmdRecursiveAndImports(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent", "--", "echo", "hello world")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent", "--", "echo", "hello world")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -63,8 +57,6 @@ func TestUniversalAuth_RunCmdRecursiveAndImports(t *testing.T) {
|
|||||||
|
|
||||||
func TestUniversalAuth_RunCmdWithImports(t *testing.T) {
|
func TestUniversalAuth_RunCmdWithImports(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--", "echo", "hello world")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--", "echo", "hello world")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -83,8 +75,6 @@ func TestUniversalAuth_RunCmdWithImports(t *testing.T) {
|
|||||||
|
|
||||||
func TestUniversalAuth_RunCmdWithoutImports(t *testing.T) {
|
func TestUniversalAuth_RunCmdWithoutImports(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false", "--", "echo", "hello world")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false", "--", "echo", "hello world")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -101,8 +91,6 @@ func TestUniversalAuth_RunCmdWithoutImports(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceToken_RunCmdWithoutImports(t *testing.T) {
|
func TestServiceToken_RunCmdWithoutImports(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false", "--", "echo", "hello world")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "run", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--silent", "--include-imports=false", "--", "echo", "hello world")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestServiceToken_GetSecretsByNameRecursive(t *testing.T) {
|
func TestServiceToken_GetSecretsByNameRecursive(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -23,8 +21,6 @@ func TestServiceToken_GetSecretsByNameRecursive(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceToken_GetSecretsByNameWithNotFoundSecret(t *testing.T) {
|
func TestServiceToken_GetSecretsByNameWithNotFoundSecret(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "DOES-NOT-EXIST", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "DOES-NOT-EXIST", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -39,8 +35,6 @@ func TestServiceToken_GetSecretsByNameWithNotFoundSecret(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceToken_GetSecretsByNameWithImports(t *testing.T) {
|
func TestServiceToken_GetSecretsByNameWithImports(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "STAGING-SECRET-2", "FOLDER-SECRET-1", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "STAGING-SECRET-2", "FOLDER-SECRET-1", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -56,8 +50,6 @@ func TestServiceToken_GetSecretsByNameWithImports(t *testing.T) {
|
|||||||
|
|
||||||
func TestUniversalAuth_GetSecretsByNameRecursive(t *testing.T) {
|
func TestUniversalAuth_GetSecretsByNameRecursive(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -73,8 +65,6 @@ func TestUniversalAuth_GetSecretsByNameRecursive(t *testing.T) {
|
|||||||
|
|
||||||
func TestUniversalAuth_GetSecretsByNameWithNotFoundSecret(t *testing.T) {
|
func TestUniversalAuth_GetSecretsByNameWithNotFoundSecret(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "DOES-NOT-EXIST", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "TEST-SECRET-2", "FOLDER-SECRET-1", "DOES-NOT-EXIST", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -90,8 +80,6 @@ func TestUniversalAuth_GetSecretsByNameWithNotFoundSecret(t *testing.T) {
|
|||||||
|
|
||||||
func TestUniversalAuth_GetSecretsByNameWithImports(t *testing.T) {
|
func TestUniversalAuth_GetSecretsByNameWithImports(t *testing.T) {
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "STAGING-SECRET-2", "FOLDER-SECRET-1", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "get", "TEST-SECRET-1", "STAGING-SECRET-2", "FOLDER-SECRET-1", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import (
|
|||||||
|
|
||||||
|
|
||||||
func TestServiceToken_SecretsGetWithImportsAndRecursiveCmd(t *testing.T) {
|
func TestServiceToken_SecretsGetWithImportsAndRecursiveCmd(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -25,8 +23,6 @@ func TestServiceToken_SecretsGetWithImportsAndRecursiveCmd(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceToken_SecretsGetWithoutImportsAndWithoutRecursiveCmd(t *testing.T) {
|
func TestServiceToken_SecretsGetWithoutImportsAndWithoutRecursiveCmd(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--include-imports=false", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.ServiceToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--include-imports=false", "--silent")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -41,7 +37,6 @@ func TestServiceToken_SecretsGetWithoutImportsAndWithoutRecursiveCmd(t *testing.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUniversalAuth_SecretsGetWithImportsAndRecursiveCmd(t *testing.T) {
|
func TestUniversalAuth_SecretsGetWithImportsAndRecursiveCmd(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--recursive", "--silent")
|
||||||
@@ -58,7 +53,6 @@ func TestUniversalAuth_SecretsGetWithImportsAndRecursiveCmd(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUniversalAuth_SecretsGetWithoutImportsAndWithoutRecursiveCmd(t *testing.T) {
|
func TestUniversalAuth_SecretsGetWithoutImportsAndWithoutRecursiveCmd(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--include-imports=false", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--include-imports=false", "--silent")
|
||||||
@@ -75,7 +69,6 @@ func TestUniversalAuth_SecretsGetWithoutImportsAndWithoutRecursiveCmd(t *testing
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUniversalAuth_SecretsGetWrongEnvironment(t *testing.T) {
|
func TestUniversalAuth_SecretsGetWrongEnvironment(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
MachineIdentityLoginCmd(t)
|
MachineIdentityLoginCmd(t)
|
||||||
|
|
||||||
output, _ := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", "invalid-env", "--recursive", "--silent")
|
output, _ := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--token", creds.UAAccessToken, "--projectId", creds.ProjectID, "--env", "invalid-env", "--recursive", "--silent")
|
||||||
@@ -89,9 +82,6 @@ func TestUniversalAuth_SecretsGetWrongEnvironment(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUserAuth_SecretsGetAll(t *testing.T) {
|
func TestUserAuth_SecretsGetAll(t *testing.T) {
|
||||||
SetupCli(t)
|
|
||||||
UserLoginCmd(t);
|
|
||||||
|
|
||||||
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--include-imports=false", "--silent")
|
output, err := ExecuteCliCommand(FORMATTED_CLI_NAME, "secrets", "--projectId", creds.ProjectID, "--env", creds.EnvSlug, "--include-imports=false", "--silent")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error running CLI command: %v", err)
|
t.Fatalf("error running CLI command: %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user