Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ functional-with-fault-injection-test: clean-test-output

mixed-brain-test: clean-test-output
@printf $(COLOR) "Run mixed brain tests..."
@CGO_ENABLED=1 TEST_OUTPUT_ROOT=$(CURDIR)/$(TEST_OUTPUT_ROOT) go test -v $(MIXED_BRAIN_TEST_ROOT) $(COMPILED_TEST_ARGS) 2>&1 | tee -a test.log
@cd $(MIXED_BRAIN_TEST_ROOT) && CGO_ENABLED=1 TEST_OUTPUT_ROOT=$(CURDIR)/$(TEST_OUTPUT_ROOT) go test -v ./... $(COMPILED_TEST_ARGS) 2>&1 | tee -a $(CURDIR)/test.log
@$(MAKE) verify-test-log

verify-test-log:
Expand Down
2 changes: 2 additions & 0 deletions tests/mixedbrain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.devserver/
.devserver.lock
91 changes: 38 additions & 53 deletions tests/mixedbrain/build_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,29 @@ import (

const (
retryTimeout = 30 * time.Second
omesModule = "github.com/temporalio/omes"
omesRepo = "https://" + omesModule + ".git"
temporalRepo = "https://github.com/temporalio/temporal.git"
omesRepo = "https://github.com/temporalio/omes"
omesCommit = "8e4c1f54f3b0fb5e39d131f859c56fb2236395b1"
)

func sourceRoot() string {
_, filename, _, _ := runtime.Caller(0)
return filepath.Join(filepath.Dir(filename), "..", "..")
}

func cloneRepo(t *testing.T, url, destDir, ref string) {
// omesRef returns the sha of github.com/temporalio/omes as pinned in go.mod,
// queried via `go list -m` so go.mod stays the single source of truth.
// Pseudo-versions look like "v0.0.0-20260512170720-ab5a6ff22874"; we take the
// trailing 12-char sha.
func omesRef(t *testing.T) string {
t.Helper()
t.Logf("Cloning %s at %s...", url, ref)
require.EventuallyWithT(t, func(collect *assert.CollectT) {
_ = os.RemoveAll(destDir)
out, err := exec.CommandContext(t.Context(), "git", "clone", "--filter=blob:none", url, destDir).CombinedOutput()
require.NoError(collect, err, "git clone failed:\n%s", out)
}, retryTimeout, 2*time.Second, "git clone "+filepath.Base(url))

out, err := exec.CommandContext(t.Context(), "git", "-C", destDir, "checkout", ref).CombinedOutput()
require.NoError(t, err, "git checkout %s failed:\n%s", ref, out)
}

func buildServer(t *testing.T, srcDir, outputPath string) {
t.Helper()
t.Logf("Building server binary from %s...", srcDir)
cmd := exec.CommandContext(t.Context(), "go",
"build",
"-tags", "disable_grpc_modules",
"-o", outputPath,
"./cmd/server",
)
cmd.Dir = srcDir
out, err := cmd.CombinedOutput()
require.NoError(t, err, "build server binary failed:\n%s", out)
out, err := exec.CommandContext(t.Context(), "go", "list", "-m", "-f", "{{.Version}}", omesModule).Output()
require.NoError(t, err, "go list -m %s", omesModule)
version := strings.TrimSpace(string(out))
if i := strings.LastIndex(version, "-"); i >= 0 {
return version[i+1:]
}
return version
}

// resolveReleaseVersion returns the highest version for the previous minor.
Expand All @@ -76,14 +64,10 @@ func resolveReleaseVersion(serverVersion string, tags []string) semver.Version {
return best
}

// downloadAndBuildReleaseServer finds the highest patch of the previous minor
// version, clones the repo at that tag, and builds the server binary. For
// example, if ServerVersion is 1.31.x, it will look for the highest 1.30.x
// tag. Falls back to pre-release tags (cloud versions) if no stable release
// exists yet.
func downloadAndBuildReleaseServer(t *testing.T, outputPath string) string {
// fetchPreviousMinorTag asks the temporal git remote for tags and resolves
// the latest patch of the previous minor relative to headers.ServerVersion.
func fetchPreviousMinorTag(t *testing.T) string {
t.Helper()

t.Log("Resolving release tags...")
var version semver.Version
require.EventuallyWithT(t, func(collect *assert.CollectT) {
Expand All @@ -101,30 +85,31 @@ func downloadAndBuildReleaseServer(t *testing.T, outputPath string) string {
version = resolveReleaseVersion(headers.ServerVersion, tags)
require.NotEqual(collect, semver.Version{}, version, "no tags found for previous minor")
}, retryTimeout, 2*time.Second, "fetch release tags")

tag := "v" + version.String()
repoDir := filepath.Join(filepath.Dir(outputPath), "temporal-release")
cloneRepo(t, temporalRepo, repoDir, tag)

t.Log("Building release server binary...")
buildServer(t, repoDir, outputPath)
return tag
return "v" + version.String()
}

func downloadAndBuildOmes(t *testing.T, workDir string) {
// downloadAndBuildOmes clones omes at omesRef into workDir/omes and builds its
// CLI into outputPath. We clone instead of going through the module cache so
// the build resolves omes's transitive deps independently of this module's
// go.sum (omes uses replace directives that block `go install`).
func downloadAndBuildOmes(t *testing.T, workDir, outputPath string) {
t.Helper()

repoDir := filepath.Join(workDir, "omes")
cloneRepo(t, omesRepo, repoDir, omesCommit)
ref := omesRef(t)
t.Logf("Cloning %s at %s...", omesRepo, ref)
require.EventuallyWithT(t, func(collect *assert.CollectT) {
_ = os.RemoveAll(repoDir)
out, err := exec.CommandContext(t.Context(), "git", "clone", "--filter=blob:none", omesRepo, repoDir).CombinedOutput()
require.NoError(collect, err, "git clone failed:\n%s", out)
}, retryTimeout, 2*time.Second, "git clone omes")

out, err := exec.CommandContext(t.Context(), "git", "-C", repoDir, "checkout", ref).CombinedOutput()
require.NoError(t, err, "git checkout %s failed:\n%s", ref, out)

t.Log("Building Omes...")
omesBinary := filepath.Join(workDir, "omes-bin")
buildCmd := exec.CommandContext(t.Context(), "go",
"build",
"-o", omesBinary,
"./cmd",
)
buildCmd.Dir = repoDir
out, err := buildCmd.CombinedOutput()
require.NoError(t, err, "build Omes failed:\n%s", out)
t.Logf("Building omes into %s...", outputPath)
cmd := exec.CommandContext(t.Context(), "go", "build", "-o", outputPath, "./cmd")
cmd.Dir = repoDir
out, err = cmd.CombinedOutput()
require.NoError(t, err, "build omes failed:\n%s", out)
}
212 changes: 0 additions & 212 deletions tests/mixedbrain/config_util.go

This file was deleted.

33 changes: 33 additions & 0 deletions tests/mixedbrain/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module go.temporal.io/server/tests/mixedbrain

go 1.26.3

require (
github.com/blang/semver/v4 v4.0.0
github.com/stretchr/testify v1.11.1
github.com/temporalio/omes v0.0.0-20260528212322-14460bcc246f
go.temporal.io/api v1.62.13-0.20260522153111-260c04482807
go.temporal.io/server v0.0.0-00010101000000-000000000000
go.uber.org/zap v1.27.1
google.golang.org/grpc v1.80.0
google.golang.org/protobuf v1.36.11
)

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/gofrs/flock v0.13.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect
github.com/nexus-rpc/nexus-proto-annotations v0.1.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.53.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260420184626-e10c466a9529 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260420184626-e10c466a9529 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace go.temporal.io/server => ../..

replace go.temporal.io/sdk => go.temporal.io/sdk v1.42.0
Loading
Loading