feat: expose version identity in Go SDK

This commit is contained in:
2026-09-20 18:29:18 +08:00
parent 5622a9e2f2
commit af10086570
6 changed files with 62 additions and 4 deletions

View File

@@ -15,6 +15,10 @@ func TestHealthContract(t *testing.T) {
if r.Method != "GET" || r.Header.Get("Accept") != "application/json" {
t.Error("incorrect request")
}
if r.URL.Path == "/version" {
_, _ = w.Write([]byte(`{"version":"1.2.3","revision":"abc","built_at":"now","go_version":"go1.27.1","http_protocol_version":"1","worker_protocol_version":"1","event_protocol_version":"1","workflow_schema_version":1}`))
return
}
if r.URL.Path == "/health/live" {
_, _ = w.Write([]byte(`{"status":"alive"}`))
return
@@ -31,6 +35,10 @@ func TestHealthContract(t *testing.T) {
if err != nil || live.Status != "alive" {
t.Fatalf("%+v %v", live, err)
}
info, err := client.Version(context.Background())
if err != nil || info.Version != "1.2.3" || info.Revision != "abc" || info.WorkflowSchemaVersion != 1 {
t.Fatalf("version=%+v err=%v", info, err)
}
_, err = client.Readiness(context.Background())
var status *orbit.HTTPError
if !errors.As(err, &status) || status.StatusCode != 503 || strings.Contains(err.Error(), "secret") {