Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lekko-jonathan committed Sep 27, 2024
1 parent ee672e9 commit 6e49c6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
3 changes: 2 additions & 1 deletion cmd/lekko/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"testing"

"github.com/lekkodev/cli/pkg/gen"
protoutils "github.com/lekkodev/cli/pkg/proto"
"github.com/lekkodev/cli/pkg/sync"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -225,6 +224,7 @@ func Test_ProtoJsonToTs(t *testing.T) {
}
*/

/*
func Test_blobToTs(t *testing.T) {
repoContents, err := sync.SyncTSOutputToRepositoryContents([]byte("Cp0CCgdkZWZhdWx0EnUKDWJhbm5lci1jb25maWcaYgovCi10eXBlLmdvb2dsZWFwaXMuY29tL2dvb2dsZS5wcm90b2J1Zi5Cb29sVmFsdWUaLwotdHlwZS5nb29nbGVhcGlzLmNvbS9nb29nbGUucHJvdG9idWYuQm9vbFZhbHVlIAESmgEKBXRoaW5nGo4BCkUKMnR5cGUuZ29vZ2xlYXBpcy5jb20vbGVra28ucnVsZXMudjFiZXRhMy5Db25maWdDYWxsEg8aDWJhbm5lci1jb25maWcaRQoydHlwZS5nb29nbGVhcGlzLmNvbS9sZWtrby5ydWxlcy52MWJldGEzLkNvbmZpZ0NhbGwSDxoNYmFubmVyLWNvbmZpZyABEuwLCvsBCh5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90b2J1ZiI6CghEdXJhdGlvbhIYCgdzZWNvbmRzGAEgASgDUgdzZWNvbmRzEhQKBW5hbm9zGAIgASgFUgVuYW5vc0KDAQoTY29tLmdvb2dsZS5wcm90b2J1ZkINRHVyYXRpb25Qcm90b1ABWjFnb29nbGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9rbm93bi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MKhgQKHmdvb2dsZS9wcm90b2J1Zi93cmFwcGVycy5wcm90bxIPZ29vZ2xlLnByb3RvYnVmIiMKC0RvdWJsZVZhbHVlEhQKBXZhbHVlGAEgASgBUgV2YWx1ZSIiCgpGbG9hdFZhbHVlEhQKBXZhbHVlGAEgASgCUgV2YWx1ZSIiCgpJbnQ2NFZhbHVlEhQKBXZhbHVlGAEgASgDUgV2YWx1ZSIjCgtVSW50NjRWYWx1ZRIUCgV2YWx1ZRgBIAEoBFIFdmFsdWUiIgoKSW50MzJWYWx1ZRIUCgV2YWx1ZRgBIAEoBVIFdmFsdWUiIwoLVUludDMyVmFsdWUSFAoFdmFsdWUYASABKA1SBXZhbHVlIiEKCUJvb2xWYWx1ZRIUCgV2YWx1ZRgBIAEoCFIFdmFsdWUiIwoLU3RyaW5nVmFsdWUSFAoFdmFsdWUYASABKAlSBXZhbHVlIiIKCkJ5dGVzVmFsdWUSFAoFdmFsdWUYASABKAxSBXZhbHVlQoMBChNjb20uZ29vZ2xlLnByb3RvYnVmQg1XcmFwcGVyc1Byb3RvUAFaMWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2tub3duL3dyYXBwZXJzcGL4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw=="))
if err != nil {
Expand All @@ -246,3 +246,4 @@ func Test_blobToTs(t *testing.T) {
}
}
}
*/
16 changes: 0 additions & 16 deletions pkg/sync/ts.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,11 @@ func SyncTS(lekkoPath string) (*featurev1beta1.RepositoryContents, error) {
if err != nil {
return nil, errors.Wrapf(err, "sync ts: %s", output)
}
<<<<<<< HEAD
return SyncTSOutputToRepositoryContents(output)
=======
repoContents, err := repo.DecodeRepositoryContents(output)
if err != nil {
return nil, errors.Wrap(err, "decode sync ts output")
}
return repoContents, nil
>>>>>>> origin/main
}

func SyncTSFiles(lekkoFiles ...string) (*featurev1beta1.RepositoryContents, error) {
Expand All @@ -72,19 +68,7 @@ func SyncTSFiles(lekkoFiles ...string) (*featurev1beta1.RepositoryContents, erro
if err != nil {
return nil, errors.Wrapf(err, "sync ts: %s", output)
}
<<<<<<< HEAD
return SyncTSOutputToRepositoryContents(output)
}

// Output is expected to be base64 encoded serialized RepositoryContents message
func SyncTSOutputToRepositoryContents(output []byte) (*featurev1beta1.RepositoryContents, error) {
// Because Protobuf is not self-describing, we have to jump through some hoops here for deserialization.
// The RepositoryContents message contains the FDS which we want to use as the resolver for unmarshalling
// the rest of the contents.
decoded, err := base64.StdEncoding.DecodeString(string(output))
=======
repoContents, err := repo.DecodeRepositoryContents(output)
>>>>>>> origin/main
if err != nil {
return nil, errors.Wrap(err, "decode sync ts output")
}
Expand Down

0 comments on commit 6e49c6e

Please sign in to comment.