Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Don't use the latest github.com/golang/protobuf
Browse files Browse the repository at this point in the history
Turns out it uses the new protobuf version under the hood, and there are
backwards compatibility issues: golang/protobuf#1014
  • Loading branch information
rgulewich committed Nov 3, 2020
1 parent 3f1ed27 commit 6dd7c28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/titus-imds-cni/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func writeContainerInfo(pod *v1.Pod) error {
return errors.Wrap(err, "Unable to decode containerInfo protobuf")
}

out, err := json.MarshalIndent(cInfo, "", " ") // nolint: govet
out, err := json.MarshalIndent(&cInfo, "", " ")
if err != nil {
return errors.Wrap(err, "Unable to marshal containerInfo as JSON")
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,5 @@ replace k8s.io/client-go => k8s.io/client-go v0.18.4
replace k8s.io/kubectl => k8s.io/kubectl v0.18.4

replace k8s.io/api => k8s.io/api v0.18.4

replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.3
9 changes: 5 additions & 4 deletions metadataserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/gogo/protobuf/proto"
protobuf "github.com/golang/protobuf/proto" // nolint: staticcheck
"github.com/gorilla/mux"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -396,7 +397,7 @@ func validateTaskIdentityRequest(t *testing.T, keyPair testKeyPair) func(*stubSe
return err
}
taskIdentDoc := new(titus.TaskIdentityDocument)
err = protobuf.Unmarshal(content, taskIdentDoc)
err = proto.Unmarshal(content, taskIdentDoc)
if err != nil {
return err
}
Expand All @@ -407,14 +408,14 @@ func validateTaskIdentityRequest(t *testing.T, keyPair testKeyPair) func(*stubSe
// Identity

taskIdent := new(titus.TaskIdentity)
err = protobuf.Unmarshal(taskIdentDoc.Identity, taskIdent)
err = proto.Unmarshal(taskIdentDoc.Identity, taskIdent)
if err != nil {
return err
}
expectedTaskIdent := fakeTaskIdentity()
assert.NotNil(t, taskIdent.UnixTimestampSec)
expectedTaskIdent.UnixTimestampSec = taskIdent.UnixTimestampSec
assert.Equal(t, *expectedTaskIdent, *taskIdent) // nolint: govet
assert.Equal(t, expectedTaskIdent, taskIdent)
// The identity server checks Process for entrypoint and command:
assert.NotNil(t, taskIdent.Container.Process)
assert.Equal(t, []string{*expectedTaskIdent.Container.EntrypointStr}, taskIdent.Container.Process.Entrypoint) // nolint: staticcheck
Expand Down Expand Up @@ -494,7 +495,7 @@ func validateTaskIdentityJSONRequest(t *testing.T) func(*stubServer, *http.Respo

expectedTaskIdent := fakeTaskIdentity()
expectedTaskIdent.UnixTimestampSec = taskIdentDoc.Identity.UnixTimestampSec
assert.Equal(t, *expectedTaskIdent, *taskIdentDoc.Identity) // nolint: govet
assert.Equal(t, expectedTaskIdent, taskIdentDoc.Identity)

return nil
}
Expand Down

0 comments on commit 6dd7c28

Please sign in to comment.