functional tests: Move some functions to common file

This commit is contained in:
Krzesimir Nowak
2015-04-15 16:30:05 +02:00
parent 87b5a5b53c
commit 54d64e9603
2 changed files with 16 additions and 16 deletions
-16
View File
@@ -146,22 +146,6 @@ func subdirectories(t *testing.T, server *taas.Server) {
runRkt401(t, server.URL, "oauth-subdirectories")
}
// TODO (krnowak): Remove this when we will be able to specify
// different custom and vendor configuration directories.
const unsafeEnvVar = "RKT_ENABLE_DESTRUCTIVE_TESTS"
func skipUnsafe(t *testing.T) {
if os.Getenv(unsafeEnvVar) != "1" {
t.Skipf("%s envvar is not specified or has value different than 1, skipping the test", unsafeEnvVar)
}
}
func removeDataDir(t *testing.T) {
if err := os.RemoveAll("/var/lib/rkt"); err != nil {
t.Fatalf("Failed to remove /var/lib/rkt: %v", err)
}
}
func runServer(t *testing.T, auth taas.Type) *taas.Server {
goTool := getAbs(t, "go")
acTool := getAbs(t, "../bin/actool")
+16
View File
@@ -16,9 +16,25 @@ package main
import (
"fmt"
"os"
"os/exec"
"testing"
)
const unsafeEnvVar = "RKT_ENABLE_DESTRUCTIVE_TESTS"
func skipUnsafe(t *testing.T) {
if v := os.Getenv(unsafeEnvVar); v != "1" {
t.Skipf("%s envvar is not specified or has value different than 1 (%s), skipping the test", unsafeEnvVar, v)
}
}
func removeDataDir(t *testing.T) {
if err := os.RemoveAll("/var/lib/rkt"); err != nil {
t.Fatalf("Failed to remove /var/lib/rkt: %v", err)
}
}
func patchTestACI(newFileName string, args ...string) {
var allArgs []string
allArgs = append(allArgs, "patch-manifest")