diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index 621e4df..b506770 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -226,7 +226,7 @@ spec: time.Sleep(2 * time.Second) err = os.WriteFile("./adminConfig", []byte(fmt.Sprintf(` - {"masters":[{"name":"http://localhost:%s","zone":"zone1"}], + {"masters":[{"name":"http://127.0.0.1:%s","zone":"zone1"}], "token":"%s"}`, c.master.WsPort, c.client.Token)), 0666) assert.NoError(t, err) @@ -273,11 +273,14 @@ spec: time.Sleep(2 * time.Second) err = os.WriteFile("./adminConfig", []byte(fmt.Sprintf(` - {"masters":[{"name":"http://localhost:%s","zone":"zone1"}], + {"masters":[{"name":"http://127.0.0.1:%s","zone":"zone1"}], "token":"%s"}`, c.master.WsPort, "blaha")), 0666) assert.NoError(t, err) buf := &bytes.Buffer{} + logrus.SetFormatter(&logrus.TextFormatter{ + DisableColors: true, + }) logrus.SetOutput(buf) a := admin.NewAdmin("./adminConfig", "", "") err = a.Exec(context.TODO(), "uptime") @@ -362,7 +365,7 @@ spec: time.Sleep(1 * time.Second) err = os.WriteFile("./adminConfig", []byte(fmt.Sprintf(` - {"masters":[{"name":"http://localhost:%s","zone":"zone1"}], + {"masters":[{"name":"http://127.0.0.1:%s","zone":"zone1"}], "token":"%s"}`, c.master.WsPort, c.client.Token)), 0666) assert.NoError(t, err) diff --git a/e2e/gitrepo/.gitignore b/e2e/gitrepo/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/e2e/utils_test.go b/e2e/utils_test.go index 7ac2f88..f6f95b2 100644 --- a/e2e/utils_test.go +++ b/e2e/utils_test.go @@ -30,7 +30,6 @@ type testWrapper struct { } func initMasterAgent(t *testing.T, ctx context.Context) testWrapper { - logrus.SetLevel(logrus.DebugLevel) port, err := freePort() assert.NoError(t, err) @@ -45,14 +44,14 @@ func initMasterAgent(t *testing.T, ctx context.Context) testWrapper { RedisClient: redisMock, Masters: config.Masters{ { - URL: "http://localhost:" + portStr, + URL: "http://127.0.0.1:" + portStr, Zone: "zone1", }, }, } mockedCommander := mocks.NewMockCommander(t) agent := agent.NewAgent("./agentConfig", mockedCommander) - agent.Master = "http://localhost:" + portStr + agent.Master = "http://127.0.0.1:" + portStr agent.Hostname = "mycooltestagent" wg := &sync.WaitGroup{} @@ -72,7 +71,7 @@ func initMasterAgent(t *testing.T, ctx context.Context) testWrapper { }() time.Sleep(400 * time.Millisecond) - client := authedhttpclient.New(t, "http://localhost:"+portStr) + client := authedhttpclient.New(t, "http://127.0.0.1:"+portStr) err = client.AuthAsAdmin() assert.NoError(t, err) @@ -90,7 +89,7 @@ func initMasterAgent(t *testing.T, ctx context.Context) testWrapper { } func freePort() (port int, err error) { var a *net.TCPAddr - if a, err = net.ResolveTCPAddr("tcp", "localhost:0"); err == nil { + if a, err = net.ResolveTCPAddr("tcp", "127.0.0.1:0"); err == nil { var l *net.TCPListener if l, err = net.ListenTCP("tcp", a); err == nil { port := l.Addr().(*net.TCPAddr).Port diff --git a/pkg/master/master.go b/pkg/master/master.go index 664b861..d916c42 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -625,6 +625,10 @@ func (m *Master) clone(ctx context.Context, authOpts *git.AuthOptions, cloneOpts continue } + if len(b) == 0 { + continue // skip empty files + } + err = yaml.Unmarshal(b, machine) if err != nil { logrus.Errorf("error yaml parse: %s err: %s", path, err)