-
Notifications
You must be signed in to change notification settings - Fork 33
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
Download specs gzipped for 'compute vocabulary' and visitor list operations. #1122
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,11 @@ | |
package visitor | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"testing" | ||
|
||
"github.com/apigee/registry/cmd/registry/compress" | ||
"github.com/apigee/registry/pkg/connection/grpctest" | ||
"github.com/apigee/registry/pkg/names" | ||
"github.com/apigee/registry/rpc" | ||
|
@@ -29,6 +31,10 @@ func TestFetch(t *testing.T) { | |
parent := project.String() + "/locations/global" | ||
|
||
specContents := "hello" | ||
gzippedSpecContents, err := compress.GZippedBytes([]byte(specContents)) | ||
if err != nil { | ||
t.Fatalf("Setup: Failed to compress test data: %s", err) | ||
} | ||
artifactContents := "hello" | ||
|
||
ctx := context.Background() | ||
|
@@ -62,8 +68,8 @@ func TestFetch(t *testing.T) { | |
ApiSpecId: "s", | ||
Parent: versionName.String(), | ||
ApiSpec: &rpc.ApiSpec{ | ||
Contents: []byte(specContents), | ||
MimeType: "text/plain", | ||
Contents: gzippedSpecContents, | ||
MimeType: "text/plain+gzip", | ||
}, | ||
}) | ||
if err != nil { | ||
|
@@ -91,7 +97,7 @@ func TestFetch(t *testing.T) { | |
if err != nil { | ||
t.Fatalf("Failed to fetch spec contents: %s", err) | ||
} | ||
if string(spec.Contents) != specContents { | ||
if !bytes.Equal(spec.Contents, gzippedSpecContents) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the following two changes show an inconsistency -- |
||
t.Fatalf("Fetched unexpected spec contents: wanted %q got %q", specContents, spec.Contents) | ||
} | ||
}) | ||
|
@@ -111,7 +117,7 @@ func TestFetch(t *testing.T) { | |
t.Fatalf("Failed to parse spec name: %s", err) | ||
} | ||
err = GetSpec(ctx, registryClient, specName, true, func(ctx context.Context, spec *rpc.ApiSpec) error { | ||
if string(spec.Contents) != specContents { | ||
if !bytes.Equal(spec.Contents, gzippedSpecContents) { | ||
t.Fatalf("Fetched unexpected spec contents: wanted %q got %q", specContents, spec.Contents) | ||
} | ||
return nil | ||
|
@@ -146,7 +152,7 @@ func TestFetch(t *testing.T) { | |
t.Fatalf("Failed to parse spec revision name: %s", err) | ||
} | ||
err = GetSpecRevision(ctx, registryClient, specRevisionName, true, func(ctx context.Context, spec *rpc.ApiSpec) error { | ||
if string(spec.Contents) != specContents { | ||
if !bytes.Equal(spec.Contents, gzippedSpecContents) { | ||
t.Fatalf("Fetched unexpected spec contents: wanted %q got %q", specContents, spec.Contents) | ||
} | ||
return nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a kick of a tire to get the CLA check to run again... but it was also needed