Browse Source

:robot: Stabilize tests

mudler 3 years ago
parent
commit
10911670ca
4 changed files with 8 additions and 4 deletions
  1. 3 0
      api/api_test.go
  2. 3 2
      pkg/services/alive_test.go
  3. 1 1
      pkg/services/dns_test.go
  4. 1 1
      pkg/trustzone/trustzone_test.go

+ 3 - 0
api/api_test.go

@@ -53,6 +53,9 @@ var _ = Describe("API", func() {
 			e, _ := node.New(node.FromBase64(true, true, token), node.WithStore(&blockchain.MemoryStore{}), l)
 			e, _ := node.New(node.FromBase64(true, true, token), node.WithStore(&blockchain.MemoryStore{}), l)
 			e.Start(ctx)
 			e.Start(ctx)
 
 
+			e2, _ := node.New(node.FromBase64(true, true, token), node.WithStore(&blockchain.MemoryStore{}), l)
+			e2.Start(ctx)
+
 			go func() {
 			go func() {
 				err := API(ctx, fmt.Sprintf("unix://%s", socket), 10*time.Second, 20*time.Second, e, nil, false)
 				err := API(ctx, fmt.Sprintf("unix://%s", socket), 10*time.Second, 20*time.Second, e, nil, false)
 				Expect(err).ToNot(HaveOccurred())
 				Expect(err).ToNot(HaveOccurred())

+ 3 - 2
pkg/services/alive_test.go

@@ -74,7 +74,7 @@ var _ = Describe("Alive service", func() {
 	Context("Aliveness Scrub", func() {
 	Context("Aliveness Scrub", func() {
 		BeforeEach(func() {
 		BeforeEach(func() {
 			opts = append(
 			opts = append(
-				Alive(5*time.Second, 20*time.Second, 15*time.Minute),
+				Alive(10*time.Second, 30*time.Second, 15*time.Minute),
 				node.WithDiscoveryInterval(10*time.Second),
 				node.WithDiscoveryInterval(10*time.Second),
 				node.FromBase64(true, true, token),
 				node.FromBase64(true, true, token),
 				l)
 				l)
@@ -87,6 +87,7 @@ var _ = Describe("Alive service", func() {
 			e1, _ := node.New(append(opts, node.WithStore(&blockchain.MemoryStore{}))...)
 			e1, _ := node.New(append(opts, node.WithStore(&blockchain.MemoryStore{}))...)
 
 
 			e1.Start(ctx)
 			e1.Start(ctx)
+			time.Sleep(5 * time.Second)
 			e2.Start(ctx)
 			e2.Start(ctx)
 
 
 			ll, _ := e1.Ledger()
 			ll, _ := e1.Ledger()
@@ -114,7 +115,7 @@ var _ = Describe("Alive service", func() {
 					return []string{}
 					return []string{}
 				}
 				}
 				return AvailableNodes(ll, 15*time.Minute)
 				return AvailableNodes(ll, 15*time.Minute)
-			}, 120*time.Second, 1*time.Second).Should(BeEmpty())
+			}, 360*time.Second, 1*time.Second).Should(BeEmpty())
 
 
 			Expect(ll.LastBlock().Index).ToNot(Equal(index))
 			Expect(ll.LastBlock().Index).ToNot(Equal(index))
 			index = ll.LastBlock().Index
 			index = ll.LastBlock().Index

+ 1 - 1
pkg/services/dns_test.go

@@ -56,7 +56,7 @@ var _ = Describe("DNS service", func() {
 
 
 			ll, _ := e2.Ledger()
 			ll, _ := e2.Ledger()
 
 
-			AnnounceDNSRecord(ctx, ll, 15*time.Second, `test.foo.`, types.DNS{
+			AnnounceDNSRecord(ctx, ll, 60*time.Second, `test.foo.`, types.DNS{
 				dns.Type(dns.TypeA): "2.2.2.2",
 				dns.Type(dns.TypeA): "2.2.2.2",
 			})
 			})
 
 

+ 1 - 1
pkg/trustzone/trustzone_test.go

@@ -147,7 +147,7 @@ var _ = Describe("trustzone", func() {
 			l, err = e.Ledger()
 			l, err = e.Ledger()
 			Expect(err).ToNot(HaveOccurred())
 			Expect(err).ToNot(HaveOccurred())
 
 
-			go e.Start(ctx)
+			e.Start(ctx)
 
 
 			Eventually(func() bool {
 			Eventually(func() bool {
 				if e.Host() == nil {
 				if e.Host() == nil {