Skip to content

Commit

Permalink
fix nextclouds tests to not rely on grpc XXX fields
Browse files Browse the repository at this point in the history
  • Loading branch information
labkode committed Aug 6, 2024
1 parent dac90fc commit 1c50efd
Showing 1 changed file with 31 additions and 67 deletions.
98 changes: 31 additions & 67 deletions pkg/storage/fs/nextcloud/nextcloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,27 +217,18 @@ var _ = Describe("Nextcloud", func() {
Opaque: nil,
Type: provider.ResourceType_RESOURCE_TYPE_FILE,
Id: &provider.ResourceId{
StorageId: "",
OpaqueId: "fileid-/some/path",
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
StorageId: "",
OpaqueId: "fileid-/some/path",
},
Checksum: &provider.ResourceChecksum{
Type: 0,
Sum: "",
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Type: 0,
Sum: "",
},
Etag: "deadbeef",
MimeType: "text/plain",
Mtime: &types.Timestamp{
Seconds: 1234567890,
Nanos: 0,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Seconds: 1234567890,
Nanos: 0,
},
Path: "/some/path",
PermissionSet: conversions.RoleFromOCSPermissions(conversions.Permissions(0)).CS3ResourcePermissions(),
Expand All @@ -247,12 +238,9 @@ var _ = Describe("Nextcloud", func() {
OpaqueId: "",
Type: 1,
},
Target: "",
CanonicalMetadata: nil,
ArbitraryMetadata: nil,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Target: "",
CanonicalMetadata: nil,
ArbitraryMetadata: nil,
}))
checkCalled(called, `POST /apps/sciencemesh/~tester/api/storage/GetMD {"ref":{"resource_id":{"storage_id":"storage-id","opaque_id":"opaque-id"},"path":"/some/path"},"mdKeys":["val1","val2","val3"]}`)
})
Expand All @@ -279,27 +267,18 @@ var _ = Describe("Nextcloud", func() {
Opaque: nil,
Type: provider.ResourceType_RESOURCE_TYPE_FILE,
Id: &provider.ResourceId{
StorageId: "",
OpaqueId: "fileid-/some/path",
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
StorageId: "",
OpaqueId: "fileid-/some/path",
},
Checksum: &provider.ResourceChecksum{
Type: 0,
Sum: "",
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Type: 0,
Sum: "",
},
Etag: "deadbeef",
MimeType: "text/plain",
Mtime: &types.Timestamp{
Seconds: 1234567890,
Nanos: 0,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Seconds: 1234567890,
Nanos: 0,
},
Path: "/some/path",
PermissionSet: conversions.RoleFromOCSPermissions(conversions.Permissions(0)).CS3ResourcePermissions(),
Expand All @@ -309,12 +288,9 @@ var _ = Describe("Nextcloud", func() {
OpaqueId: "",
Type: 1,
},
Target: "",
CanonicalMetadata: nil,
ArbitraryMetadata: nil,
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Target: "",
CanonicalMetadata: nil,
ArbitraryMetadata: nil,
}))
Expect(err).ToNot(HaveOccurred())
checkCalled(called, `POST /apps/sciencemesh/~tester/api/storage/ListFolder {"ref":{"resource_id":{"storage_id":"storage-id","opaque_id":"opaque-id"},"path":"/some"},"mdKeys":["val1","val2","val3"]}`)
Expand Down Expand Up @@ -419,13 +395,10 @@ var _ = Describe("Nextcloud", func() {
},
},
},
Key: "version-12",
Size: uint64(12345),
Mtime: uint64(1234567890),
Etag: "deadb00f",
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Key: "version-12",
Size: uint64(12345),
Mtime: uint64(1234567890),
Etag: "deadb00f",
}))
Expect(*results[1]).To(Equal(provider.FileVersion{
Opaque: &types.Opaque{
Expand All @@ -435,13 +408,10 @@ var _ = Describe("Nextcloud", func() {
},
},
},
Key: "asdf",
Size: uint64(12345),
Mtime: uint64(1234567890),
Etag: "deadbeef",
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
Key: "asdf",
Size: uint64(12345),
Mtime: uint64(1234567890),
Etag: "deadbeef",
}))
checkCalled(called, `POST /apps/sciencemesh/~tester/api/storage/ListRevisions {"resource_id":{"storage_id":"storage-id","opaque_id":"opaque-id"},"path":"/some/path"}`)
})
Expand Down Expand Up @@ -505,17 +475,11 @@ var _ = Describe("Nextcloud", func() {
Opaque: &types.Opaque{},
Key: "some-deleted-version",
Ref: &provider.Reference{
ResourceId: &provider.ResourceId{},
Path: "/some/file.txt",
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
},
Size: uint64(12345),
DeletionTime: &types.Timestamp{Seconds: uint64(1234567890)},
XXX_NoUnkeyedLiteral: struct{}{},
XXX_unrecognized: nil,
XXX_sizecache: 0,
ResourceId: &provider.ResourceId{},
Path: "/some/file.txt",
},
Size: uint64(12345),
DeletionTime: &types.Timestamp{Seconds: uint64(1234567890)},
}))
checkCalled(called, `POST /apps/sciencemesh/~tester/api/storage/ListRecycle {"key":"asdf","path":"/some/file.txt"}`)
})
Expand Down

0 comments on commit 1c50efd

Please sign in to comment.