Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new temporalproto JSON APIs #375

Merged
merged 4 commits into from
Nov 29, 2023
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ jobs:
feature-tests-go:
uses: ./.github/workflows/go.yaml
with:
# First commit that supports google/protobuf
version: f9d73bfdf7c8d3ec0311306140fbfafa7fb6f9cf
# First commit that supports the new temporalproto APIs
version: 77626eee301574bc4cfd756dbf0641c61e9e6907
version-is-repo-ref: true
features-repo-ref: ${{ github.head_ref }}
features-repo-path: ${{ github.event.pull_request.head.repo.full_name }}
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
# TODO: Find some way to automatically upgrade to "latest"
with:
do-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
go-repo-ref: 'f9d73bfdf7c8d3ec0311306140fbfafa7fb6f9cf'
go-repo-ref: '77626eee301574bc4cfd756dbf0641c61e9e6907'
ts-ver: 'v1.5.2'
java-ver: 'v1.22.0'
py-ver: 'v1.4.0'
Expand Down
6 changes: 3 additions & 3 deletions features/data_converter/binary/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ func CheckResult(ctx context.Context, runner *harness.Runner, run client.Workflo
}

// load JSON payload from `./payload.json` and compare it to result payload
file, err := os.Open(filepath.Join(runner.Feature.AbsDir, "../../../features/data_converter/binary/payload.json"))
contents, err := os.ReadFile(filepath.Join(runner.Feature.AbsDir, "../../../features/data_converter/binary/payload.json"))
if err != nil {
return err
}

expectedPayload := &common.Payload{}
decoder := temporalproto.NewJSONDecoder(file, false)
if err := decoder.Decode(expectedPayload); err != nil {
var opts temporalproto.CustomJSONUnmarshalOptions
if err := opts.Unmarshal(contents, expectedPayload); err != nil {
return err
}
runner.Require.True(proto.Equal(expectedPayload, payload))
Expand Down
6 changes: 3 additions & 3 deletions features/data_converter/empty/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ func CheckResult(ctx context.Context, runner *harness.Runner, run client.Workflo
payload := attrs.GetInput().GetPayloads()[0]

// load JSON payload from `./payload.json` and compare it to result payload
file, err := os.Open(path.Join(runner.Feature.AbsDir, "payload.json"))
contents, err := os.ReadFile(path.Join(runner.Feature.AbsDir, "payload.json"))
if err != nil {
return err
}

expectedPayload := &common.Payload{}
decoder := temporalproto.NewJSONDecoder(file, false)
if err := decoder.Decode(expectedPayload); err != nil {
var opts temporalproto.CustomJSONUnmarshalOptions
if err := opts.Unmarshal(contents, expectedPayload); err != nil {
return err
}
runner.Require.True(proto.Equal(expectedPayload, payload))
Expand Down
3 changes: 2 additions & 1 deletion features/data_converter/json_protobuf/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ func CheckResult(ctx context.Context, runner *harness.Runner, run client.Workflo
runner.Require.Equal("temporal.api.common.v1.DataBlob", messageType)

resultInHistory := commonpb.DataBlob{}
if err := temporalproto.UnmarshalJSON(payload.GetData(), &resultInHistory); err != nil {
var opts temporalproto.CustomJSONUnmarshalOptions
if err := opts.Unmarshal(payload.GetData(), &resultInHistory); err != nil {
return err
}

Expand Down
16 changes: 8 additions & 8 deletions features/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require (
github.com/google/uuid v1.3.1
github.com/temporalio/features/harness/go v1.0.0
github.com/uber-go/tally/v4 v4.1.1
go.temporal.io/api v1.26.1-0.20231121220434-5a4d95cc60c0
go.temporal.io/sdk v1.25.2-0.20231121222453-f9d73bfdf7c8
go.temporal.io/sdk/contrib/tally v0.1.0
go.temporal.io/api v1.26.1
go.temporal.io/sdk v1.25.2-0.20231129163633-77626eee3015
go.temporal.io/sdk/contrib/tally v0.2.1-0.20231129163633-77626eee3015
golang.org/x/mod v0.11.0
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.31.0
Expand All @@ -31,13 +31,13 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
88 changes: 16 additions & 72 deletions features/go.sum

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/temporalio/features/features v1.0.0
github.com/temporalio/features/harness/go v1.0.0
github.com/urfave/cli/v2 v2.25.7
go.temporal.io/sdk v1.25.2-0.20231121222453-f9d73bfdf7c8
go.temporal.io/sdk v1.25.2-0.20231129163633-77626eee3015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the biggest fan of using untagged SDKs in the features repo main branch. But I guess we had already done it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. As we discussed (this is for public record, hello!) I'm going to merge from now to keep usage simple since this is a breaking change that hit both the SDK and the Server, but will do so next time.

golang.org/x/mod v0.12.0
)

Expand All @@ -30,18 +30,18 @@ require (
github.com/twmb/murmur3 v1.1.8 // indirect
github.com/uber-go/tally/v4 v4.1.7 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.temporal.io/api v1.26.1-0.20231121220434-5a4d95cc60c0 // indirect
go.temporal.io/sdk/contrib/tally v0.2.0 // indirect
go.temporal.io/api v1.26.1 // indirect
go.temporal.io/sdk/contrib/tally v0.2.1-0.20231129163633-77626eee3015 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/genproto v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading
Loading