Skip to content

Commit

Permalink
Add E2E to validate scheduler after init.
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Souza <[email protected]>
  • Loading branch information
artursouza committed Jul 17, 2024
1 parent 29d29ab commit 261bcec
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/e2e/standalone/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package standalone_test

import (
"context"
"net"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"testing"

Expand Down Expand Up @@ -157,6 +159,16 @@ func TestStandaloneInit(t *testing.T) {
verifyContainers(t, latestDaprRuntimeVersion)
verifyBinaries(t, daprPath, latestDaprRuntimeVersion, latestDaprDashboardVersion)
verifyConfigs(t, daprPath)

placementPort := 50005
schedulerPort := 50006
if runtime.GOOS == "windows" {
placementPort = 6050
schedulerPort = 6060
}

verifyTCPLocalhost(t, placementPort)
verifyTCPLocalhost(t, schedulerPort)
})

t.Run("init without runtime-version flag with mariner images", func(t *testing.T) {
Expand Down Expand Up @@ -353,3 +365,14 @@ func verifyConfigs(t *testing.T, daprPath string) {
})
}
}

// verifyTCPLocalhost verifies a given localhost TCP port is being listened to.
func verifyTCPLocalhost(t *testing.T, port int) {
// Check that the server is up and can accept connections.
endpoint := "127.0.0.1:" + strconv.Itoa(port)
conn, err := net.Dial("tcp", endpoint)
if err != nil {
t.Error("could not connect to "+endpoint, err)
}
defer conn.Close()
}

0 comments on commit 261bcec

Please sign in to comment.