Explorar el Código

:robot: Adapt to ginkgov2 restrictions

Ettore Di Giacinto hace 3 años
padre
commit
32e36c90ce
Se han modificado 2 ficheros con 15 adiciones y 11 borrados
  1. 15 0
      api/client/client_suite_test.go
  2. 0 11
      api/client/client_test.go

+ 15 - 0
api/client/client_suite_test.go

@@ -19,11 +19,16 @@ import (
 	"fmt"
 	"os"
 	"testing"
+	"time"
+
+	. "github.com/mudler/edgevpn/api/client"
 
 	. "github.com/onsi/ginkgo/v2"
 	. "github.com/onsi/gomega"
 )
 
+var testInstance = os.Getenv("TEST_INSTANCE")
+
 func TestClient(t *testing.T) {
 	if testInstance == "" {
 		fmt.Println("a testing instance has to be defined with TEST_INSTANCE")
@@ -32,3 +37,13 @@ func TestClient(t *testing.T) {
 	RegisterFailHandler(Fail)
 	RunSpecs(t, "Client Suite")
 }
+
+var _ = BeforeSuite(func() {
+	// Start the test suite only if we have some machines connected
+
+	Eventually(func() (int, error) {
+		c := NewClient(WithHost(testInstance))
+		m, err := c.Machines()
+		return len(m), err
+	}, 100*time.Second, 1*time.Second).Should(BeNumerically(">=", 0))
+})

+ 0 - 11
api/client/client_test.go

@@ -17,7 +17,6 @@ package client_test
 
 import (
 	"math/rand"
-	"os"
 	"time"
 
 	. "github.com/onsi/ginkgo/v2"
@@ -26,8 +25,6 @@ import (
 	. "github.com/mudler/edgevpn/api/client"
 )
 
-var testInstance = os.Getenv("TEST_INSTANCE")
-
 const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
 func randStringBytes(n int) string {
@@ -41,14 +38,6 @@ func randStringBytes(n int) string {
 var _ = Describe("Client", func() {
 	c := NewClient(WithHost(testInstance))
 
-	// Start the test suite only if we have some machines connected
-	BeforeSuite(func() {
-		Eventually(func() (int, error) {
-			m, err := c.Machines()
-			return len(m), err
-		}, 100*time.Second, 1*time.Second).Should(BeNumerically(">=", 0))
-	})
-
 	Context("Operates blockchain", func() {
 		var testBucket string