mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-18 08:26:38 +02:00
dont display t.Log/t.Logf as errors in github actions (#1508)
* fix tests and github action annotations Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
bc1c8223e6
commit
1063b954de
@ -18,7 +18,7 @@ import (
|
||||
|
||||
func TestCertMagic(t *testing.T) {
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) != 0 {
|
||||
t.Skip("Travis doesn't let us bind :443")
|
||||
t.Skip()
|
||||
}
|
||||
l, err := NewProvider().Listen()
|
||||
if err != nil {
|
||||
@ -52,6 +52,10 @@ func TestCertMagic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStorageImplementation(t *testing.T) {
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) != 0 {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
apiToken, accountID := os.Getenv("CF_API_TOKEN"), os.Getenv("CF_ACCOUNT_ID")
|
||||
kvID := os.Getenv("KV_NAMESPACE_ID")
|
||||
if len(apiToken) == 0 || len(accountID) == 0 || len(kvID) == 0 {
|
||||
@ -189,6 +193,10 @@ func TestStorageImplementation(t *testing.T) {
|
||||
|
||||
// Full test with a real zone, with against LE staging
|
||||
func TestE2e(t *testing.T) {
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) != 0 {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
apiToken, accountID := os.Getenv("CF_API_TOKEN"), os.Getenv("CF_ACCOUNT_ID")
|
||||
kvID := os.Getenv("KV_NAMESPACE_ID")
|
||||
if len(apiToken) == 0 || len(accountID) == 0 || len(kvID) == 0 {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package selector
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/micro/go-micro/v2/registry/memory"
|
||||
@ -25,5 +26,7 @@ func TestRegistrySelector(t *testing.T) {
|
||||
counts[node.Id]++
|
||||
}
|
||||
|
||||
t.Logf("Selector Counts %v", counts)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Selector Counts %v", counts)
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package selector
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/micro/go-micro/v2/registry"
|
||||
@ -50,6 +51,8 @@ func TestStrategies(t *testing.T) {
|
||||
counts[node.Id]++
|
||||
}
|
||||
|
||||
t.Logf("%s: %+v\n", name, counts)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("%s: %+v\n", name, counts)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ func TestFile(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Logf("%+v", c)
|
||||
if string(c.Data) != string(data) {
|
||||
t.Logf("%+v", c)
|
||||
t.Error("data from file does not match")
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package memory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -205,7 +206,9 @@ func TestMemoryRegistryTTLConcurrent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
t.Logf("test will wait %v, then check TTL timeouts", waitTime)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("test will wait %v, then check TTL timeouts", waitTime)
|
||||
}
|
||||
|
||||
errChan := make(chan error, concurrency)
|
||||
syncChan := make(chan struct{})
|
||||
|
@ -1,6 +1,7 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -32,7 +33,9 @@ func TestRemove(t *testing.T) {
|
||||
if i := len(servs); i > 0 {
|
||||
t.Errorf("Expected 0 nodes, got %d: %+v", i, servs)
|
||||
}
|
||||
t.Logf("Services %+v", servs)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Services %+v", servs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoveNodes(t *testing.T) {
|
||||
@ -67,5 +70,7 @@ func TestRemoveNodes(t *testing.T) {
|
||||
if i := len(nodes); i != 1 {
|
||||
t.Errorf("Expected only 1 node, got %d: %+v", i, nodes)
|
||||
}
|
||||
t.Logf("Nodes %+v", nodes)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Nodes %+v", nodes)
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package router
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@ -29,7 +30,9 @@ func TestRouterStartStop(t *testing.T) {
|
||||
if err := r.Stop(); err != nil {
|
||||
t.Errorf("failed to stop router: %v", err)
|
||||
}
|
||||
t.Logf("TestRouterStartStop STOPPED")
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("TestRouterStartStop STOPPED")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRouterAdvertise(t *testing.T) {
|
||||
@ -49,7 +52,9 @@ func TestRouterAdvertise(t *testing.T) {
|
||||
|
||||
// receive announce event
|
||||
ann := <-ch
|
||||
t.Logf("received announce advert: %v", ann)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("received announce advert: %v", ann)
|
||||
}
|
||||
|
||||
// Generate random unique routes
|
||||
nrRoutes := 5
|
||||
@ -81,9 +86,13 @@ func TestRouterAdvertise(t *testing.T) {
|
||||
wg.Done()
|
||||
defer close(createDone)
|
||||
for _, route := range routes {
|
||||
t.Logf("Creating route %v", route)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Creating route %v", route)
|
||||
}
|
||||
if err := r.Table().Create(route); err != nil {
|
||||
t.Logf("Failed to create route: %v", err)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Failed to create route: %v", err)
|
||||
}
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
@ -105,7 +114,9 @@ func TestRouterAdvertise(t *testing.T) {
|
||||
t.Errorf("failed advertising events: %v", advertErr)
|
||||
default:
|
||||
// do nothing for now
|
||||
t.Logf("Router advert received: %v", advert)
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Router advert received: %v", advert)
|
||||
}
|
||||
adverts += len(advert.Events)
|
||||
}
|
||||
return
|
||||
|
@ -11,6 +11,10 @@ import (
|
||||
)
|
||||
|
||||
func TestCloudflare(t *testing.T) {
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) != 0 {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
apiToken, accountID := os.Getenv("CF_API_TOKEN"), os.Getenv("CF_ACCOUNT_ID")
|
||||
kvID := os.Getenv("KV_NAMESPACE_ID")
|
||||
if len(apiToken) == 0 || len(accountID) == 0 || len(kvID) == 0 {
|
||||
@ -31,7 +35,9 @@ func TestCloudflare(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("List: %s\n", err.Error())
|
||||
} else {
|
||||
t.Log("Listed " + strconv.Itoa(len(records)) + " records")
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Log("Listed " + strconv.Itoa(len(records)) + " records")
|
||||
}
|
||||
}
|
||||
|
||||
err = wkv.Write(&store.Record{
|
||||
|
@ -3,6 +3,7 @@ package cockroach
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -11,6 +12,10 @@ import (
|
||||
)
|
||||
|
||||
func TestSQL(t *testing.T) {
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) != 0 {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
connection := fmt.Sprintf(
|
||||
"host=%s port=%d user=%s sslmode=disable dbname=%s",
|
||||
"localhost",
|
||||
@ -23,7 +28,7 @@ func TestSQL(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := db.Ping(); err != nil {
|
||||
t.Skip(err)
|
||||
t.Fatal(err)
|
||||
}
|
||||
db.Close()
|
||||
|
||||
|
@ -53,8 +53,9 @@ func TestFileStoreDatabaseTable(t *testing.T) {
|
||||
}
|
||||
|
||||
func fileTest(s store.Store, t *testing.T) {
|
||||
t.Logf("Options %s %v\n", s.String(), s.Options())
|
||||
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Options %s %v\n", s.String(), s.Options())
|
||||
}
|
||||
// Read and Write an expiring Record
|
||||
if err := s.Write(&store.Record{
|
||||
Key: "Hello",
|
||||
@ -109,7 +110,7 @@ func fileTest(s store.Store, t *testing.T) {
|
||||
} else {
|
||||
if len(results) != 2 {
|
||||
t.Errorf("Expected 2 items, got %d", len(results))
|
||||
t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
//t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +121,7 @@ func fileTest(s store.Store, t *testing.T) {
|
||||
t.Errorf("Couldn't read all \"foo\" keys, got %# v (%s)", spew.Sdump(results), err)
|
||||
} else if len(results) != 1 {
|
||||
t.Errorf("Expected 1 item, got %d", len(results))
|
||||
t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
//t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
}
|
||||
|
||||
if err := s.Delete("foo"); err != nil {
|
||||
@ -163,7 +164,7 @@ func fileTest(s store.Store, t *testing.T) {
|
||||
} else {
|
||||
if len(results) != 3 {
|
||||
t.Errorf("Expected 3 items, got %d", len(results))
|
||||
t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
//t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
}
|
||||
|
||||
}
|
||||
@ -173,7 +174,7 @@ func fileTest(s store.Store, t *testing.T) {
|
||||
} else {
|
||||
if len(results) != 2 {
|
||||
t.Errorf("Expected 2 items, got %d", len(results))
|
||||
t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
//t.Logf("Table test: %v\n", spew.Sdump(results))
|
||||
}
|
||||
|
||||
}
|
||||
@ -183,7 +184,7 @@ func fileTest(s store.Store, t *testing.T) {
|
||||
} else {
|
||||
if len(results) != 1 {
|
||||
t.Errorf("Expected 1 item, got %d", len(results))
|
||||
t.Logf("Table test: %# v\n", spew.Sdump(results))
|
||||
// t.Logf("Table test: %# v\n", spew.Sdump(results))
|
||||
}
|
||||
}
|
||||
if err := s.Delete("foo"); err != nil {
|
||||
|
@ -2,6 +2,7 @@ package memory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -42,7 +43,9 @@ func TestMemoryNamespacePrefix(t *testing.T) {
|
||||
}
|
||||
|
||||
func basictest(s store.Store, t *testing.T) {
|
||||
t.Logf("Testing store %s, with options %# v\n", s.String(), pretty.Formatter(s.Options()))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Testing store %s, with options %# v\n", s.String(), pretty.Formatter(s.Options()))
|
||||
}
|
||||
// Read and Write an expiring Record
|
||||
if err := s.Write(&store.Record{
|
||||
Key: "Hello",
|
||||
@ -97,7 +100,9 @@ func basictest(s store.Store, t *testing.T) {
|
||||
if len(results) != 3 {
|
||||
t.Errorf("Expected 3 items, got %d", len(results))
|
||||
}
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
}
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
if results, err := s.Read("foo", store.ReadPrefix()); err != nil {
|
||||
@ -106,7 +111,9 @@ func basictest(s store.Store, t *testing.T) {
|
||||
if len(results) != 2 {
|
||||
t.Errorf("Expected 2 items, got %d", len(results))
|
||||
}
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
}
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
if results, err := s.Read("foo", store.ReadPrefix()); err != nil {
|
||||
@ -115,7 +122,9 @@ func basictest(s store.Store, t *testing.T) {
|
||||
if len(results) != 1 {
|
||||
t.Errorf("Expected 1 item, got %d", len(results))
|
||||
}
|
||||
t.Logf("Prefix test: %# v\n", pretty.Formatter(results))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Prefix test: %# v\n", pretty.Formatter(results))
|
||||
}
|
||||
}
|
||||
if err := s.Delete("foo", func(d *store.DeleteOptions) {}); err != nil {
|
||||
t.Errorf("Delete failed (%v)", err)
|
||||
@ -156,7 +165,9 @@ func basictest(s store.Store, t *testing.T) {
|
||||
if len(results) != 3 {
|
||||
t.Errorf("Expected 3 items, got %d", len(results))
|
||||
}
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
}
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
if results, err := s.Read("foo", store.ReadSuffix()); err != nil {
|
||||
@ -165,7 +176,9 @@ func basictest(s store.Store, t *testing.T) {
|
||||
if len(results) != 2 {
|
||||
t.Errorf("Expected 2 items, got %d", len(results))
|
||||
}
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Prefix test: %v\n", pretty.Formatter(results))
|
||||
}
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
if results, err := s.Read("foo", store.ReadSuffix()); err != nil {
|
||||
@ -174,7 +187,9 @@ func basictest(s store.Store, t *testing.T) {
|
||||
if len(results) != 1 {
|
||||
t.Errorf("Expected 1 item, got %d", len(results))
|
||||
}
|
||||
t.Logf("Prefix test: %# v\n", pretty.Formatter(results))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Prefix test: %# v\n", pretty.Formatter(results))
|
||||
}
|
||||
}
|
||||
if err := s.Delete("foo"); err != nil {
|
||||
t.Errorf("Delete failed (%v)", err)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/micro/go-micro/v2/transport"
|
||||
@ -24,7 +25,9 @@ func TestMemoryTransport(t *testing.T) {
|
||||
if err := sock.Recv(&m); err != nil {
|
||||
return
|
||||
}
|
||||
t.Logf("Server Received %s", string(m.Body))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Server Received %s", string(m.Body))
|
||||
}
|
||||
if err := sock.Send(&transport.Message{
|
||||
Body: []byte(`pong`),
|
||||
}); err != nil {
|
||||
@ -54,7 +57,9 @@ func TestMemoryTransport(t *testing.T) {
|
||||
if err := c.Recv(&m); err != nil {
|
||||
return
|
||||
}
|
||||
t.Logf("Client Received %s", string(m.Body))
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("Client Received %s", string(m.Body))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package tunnel
|
||||
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@ -288,12 +289,15 @@ func TestTunnelRTTRate(t *testing.T) {
|
||||
// wait until done
|
||||
wg.Wait()
|
||||
|
||||
for _, link := range tunA.Links() {
|
||||
t.Logf("Link %s length %v rate %v", link.Id(), link.Length(), link.Rate())
|
||||
}
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
// only needed for debug
|
||||
for _, link := range tunA.Links() {
|
||||
t.Logf("Link %s length %v rate %v", link.Id(), link.Length(), link.Rate())
|
||||
}
|
||||
|
||||
for _, link := range tunB.Links() {
|
||||
t.Logf("Link %s length %v rate %v", link.Id(), link.Length(), link.Rate())
|
||||
for _, link := range tunB.Links() {
|
||||
t.Logf("Link %s length %v rate %v", link.Id(), link.Length(), link.Rate())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,8 +226,8 @@ func (s *service) start() error {
|
||||
ch <- l.Close()
|
||||
}()
|
||||
|
||||
if logger.V(logger.InfoLevel, log) {
|
||||
log.Infof("Listening on %v", l.Addr().String())
|
||||
if logger.V(logger.DebugLevel, log) {
|
||||
log.Debugf("Listening on %v", l.Addr().String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -110,7 +110,9 @@ func TestService(t *testing.T) {
|
||||
t.Fatalf("service.Run():%v", err)
|
||||
}
|
||||
case <-time.After(time.Duration(time.Second)):
|
||||
t.Logf("service.Run() survived a client request without an error")
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("service.Run() survived a client request without an error")
|
||||
}
|
||||
}
|
||||
|
||||
ch := make(chan os.Signal, 1)
|
||||
@ -125,10 +127,14 @@ func TestService(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("service.Run():%v", err)
|
||||
} else {
|
||||
t.Log("service.Run() nil return on syscall.SIGTERM")
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Log("service.Run() nil return on syscall.SIGTERM")
|
||||
}
|
||||
}
|
||||
case <-time.After(time.Duration(time.Second)):
|
||||
t.Logf("service.Run() survived a client request without an error")
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("service.Run() survived a client request without an error")
|
||||
}
|
||||
}
|
||||
|
||||
eventually(func() bool {
|
||||
@ -286,7 +292,9 @@ func TestTLS(t *testing.T) {
|
||||
t.Fatalf("service.Run():%v", err)
|
||||
}
|
||||
case <-time.After(time.Duration(time.Second)):
|
||||
t.Logf("service.Run() survived a client request without an error")
|
||||
if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
t.Logf("service.Run() survived a client request without an error")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user