Skip to content

Commit

Permalink
TESTING COMMIT FOR ACTIONS
Browse files Browse the repository at this point in the history
1- vault log level
2- consul log level
3- timeout changes in makefile
4- Next to do might be runner class
  • Loading branch information
anandmukul93 committed Feb 13, 2025
1 parent d0a7497 commit eefc234
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test:
# test-race runs the test suite.
test-race:
@echo "==> Testing ${NAME} (race)"
@go test -timeout=60s -race -tags="${GOTAGS}" ./... ${TESTARGS}
@go test -v -timeout=120s -race -tags="${GOTAGS}" ./... ${TESTARGS}
.PHONY: test-race

# _cleanup removes any previous binaries
Expand Down
16 changes: 8 additions & 8 deletions dependency/dependency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
)

func TestMain(m *testing.M) {
log.SetOutput(io.Discard)
log.SetOutput(os.Stdout)
nomadFuture := runTestNomad()
runTestVault()
tb := &test.TestingTB{}
Expand Down Expand Up @@ -269,9 +269,9 @@ func (c *ClientSet) createConsulPeerings(tenancy *test.Tenancy) error {
func runTestConsul(tb testutil.TestingTB) {
consul, err := testutil.NewTestServerConfigT(tb,
func(c *testutil.TestServerConfig) {
c.LogLevel = "warn"
c.Stdout = io.Discard
c.Stderr = io.Discard
c.LogLevel = "trace"
c.Stdout = os.Stdout
c.Stderr = os.Stdout
})
if err != nil {
Fatalf("failed to start consul server: %v", err)
Expand All @@ -293,7 +293,7 @@ func runTestNomad() <-chan error {
"-consul-auto-advertise=false",
"-consul-client-auto-join=false", "-consul-server-auto-join=false",
"-network-speed=100",
"-log-level=error", // We're just discarding it anyway
"-log-level=trace", // We're just discarding it anyway
)
cmd.Stdout = io.Discard
cmd.Stderr = io.Discard
Expand Down Expand Up @@ -436,11 +436,11 @@ func runTestVault() {
}
args := []string{
"server", "-dev", "-dev-root-token-id", vaultToken,
"-dev-no-store-token",
"-dev-no-store-token", "-log-level", "trace",
}
cmd := exec.Command("vault", args...)
cmd.Stdout = io.Discard
cmd.Stderr = io.Discard
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stdout

if err := cmd.Start(); err != nil {
Fatalf("vault failed to start: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ func TestMain(m *testing.M) {
tb := &test.TestingTB{}
consul, err := testutil.NewTestServerConfigT(tb,
func(c *testutil.TestServerConfig) {
c.LogLevel = "warn"
c.Stdout = io.Discard
c.Stderr = io.Discard
c.LogLevel = "debug"
c.Stdout = os.Stdout
c.Stderr = os.Stdout
})
if err != nil {
log.Fatal(fmt.Errorf("failed to start consul server: %v", err))
Expand Down
9 changes: 5 additions & 4 deletions watch/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestMain(m *testing.M) {

// sub-main so I can use defer
func main(m *testing.M) int {
log.SetOutput(io.Discard)
log.SetOutput(os.Stdout)
testVault = newTestVault()
defer func() { testVault.Stop() }()

Expand Down Expand Up @@ -70,11 +70,11 @@ func newTestVault() *vaultServer {
}
args := []string{
"server", "-dev", "-dev-root-token-id", vaultToken,
"-dev-no-store-token",
"-dev-no-store-token", "-log-level", "trace",
}
cmd := exec.Command("vault", args...)
cmd.Stdout = io.Discard
cmd.Stderr = io.Discard
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

if err := cmd.Start(); err != nil {
panic("vault failed to start: " + err.Error())
Expand All @@ -94,6 +94,7 @@ func vaultTokenSetup(clients *dep.ClientSet) string {
Type: "approle",
})
if err != nil && !strings.Contains(err.Error(), "path is already in use") {
log.Printf("failed to enable approle: %v", err)
panic(err)
}

Expand Down

0 comments on commit eefc234

Please sign in to comment.