Skip to content

Commit

Permalink
🤖 Adapt to ginkgov2 restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler committed Feb 3, 2022
1 parent 3550de8 commit 32e36c9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
15 changes: 15 additions & 0 deletions api/client/client_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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))
})
11 changes: 0 additions & 11 deletions api/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package client_test

import (
"math/rand"
"os"
"time"

. "github.com/onsi/ginkgo/v2"
Expand All @@ -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 {
Expand All @@ -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

Expand Down

0 comments on commit 32e36c9

Please sign in to comment.