mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 23:48:05 -05:00
test: resolved test issues
This commit is contained in:
@@ -9,14 +9,15 @@ if [ ! -f "$TEST_ENV_FILE" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Export the variables
|
# Export the variables
|
||||||
while IFS='=' read -r key value
|
while IFS= read -r line
|
||||||
do
|
do
|
||||||
# Skip empty lines and lines starting with #
|
# Skip empty lines and lines starting with #
|
||||||
if [[ -z "$key" || "$key" =~ ^\# ]]; then
|
if [[ -z "$line" || "$line" =~ ^\# ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# Use eval to correctly handle values with spaces
|
# Read the key-value pair
|
||||||
eval export $key='$value'
|
IFS='=' read -r key value <<< "$line"
|
||||||
|
eval export $key=\$value
|
||||||
done < "$TEST_ENV_FILE"
|
done < "$TEST_ENV_FILE"
|
||||||
|
|
||||||
echo "Test environment variables set."
|
echo "Test environment variables set."
|
||||||
|
|||||||
@@ -77,22 +77,19 @@ func UserLoginCmd() {
|
|||||||
n, err := ptmx.Read(buf)
|
n, err := ptmx.Read(buf)
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
terminalOut := string(buf)
|
terminalOut := string(buf)
|
||||||
if strings.Contains(terminalOut, "Add a new account") && step < 0 {
|
if strings.Contains(terminalOut, "Infisical Cloud") && step < 0 {
|
||||||
step += 1
|
|
||||||
stepChan <- step
|
|
||||||
} else if strings.Contains(terminalOut, "Infisical Cloud") && step < 1 {
|
|
||||||
step += 1;
|
step += 1;
|
||||||
stepChan <- step
|
stepChan <- step
|
||||||
} else if strings.Contains(terminalOut, "Email") && step < 2 {
|
} else if strings.Contains(terminalOut, "Email") && step < 1 {
|
||||||
step += 1;
|
step += 1;
|
||||||
stepChan <- step
|
stepChan <- step
|
||||||
} else if strings.Contains(terminalOut, "Password") && step < 3 {
|
} else if strings.Contains(terminalOut, "Password") && step < 2 {
|
||||||
step += 1;
|
step += 1;
|
||||||
stepChan <- step
|
stepChan <- step
|
||||||
} else if strings.Contains(terminalOut, "Infisical organization") && step < 4 {
|
} else if strings.Contains(terminalOut, "Infisical organization") && step < 3 {
|
||||||
step += 1;
|
step += 1;
|
||||||
stepChan <- step
|
stepChan <- step
|
||||||
} else if strings.Contains(terminalOut, "Enter passphrase") && step < 5 {
|
} else if strings.Contains(terminalOut, "Enter passphrase") && step < 4 {
|
||||||
step += 1;
|
step += 1;
|
||||||
stepChan <- step
|
stepChan <- step
|
||||||
}
|
}
|
||||||
@@ -106,17 +103,15 @@ func UserLoginCmd() {
|
|||||||
|
|
||||||
for i := range stepChan {
|
for i := range stepChan {
|
||||||
switch i {
|
switch i {
|
||||||
case 0:
|
case 0:
|
||||||
ptmx.Write([]byte("\n"))
|
ptmx.Write([]byte("\n"))
|
||||||
case 1:
|
case 1:
|
||||||
ptmx.Write([]byte("\n"))
|
|
||||||
case 2:
|
|
||||||
ptmx.Write([]byte(creds.UserEmail))
|
ptmx.Write([]byte(creds.UserEmail))
|
||||||
ptmx.Write([]byte("\n"))
|
ptmx.Write([]byte("\n"))
|
||||||
case 3:
|
case 2:
|
||||||
ptmx.Write([]byte(creds.UserPassword))
|
ptmx.Write([]byte(creds.UserPassword))
|
||||||
ptmx.Write([]byte("\n"))
|
ptmx.Write([]byte("\n"))
|
||||||
case 4:
|
case 3:
|
||||||
ptmx.Write([]byte("\n"))
|
ptmx.Write([]byte("\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user