From a538874c071c76b41ea178a73a3e065af3bc0a40 Mon Sep 17 00:00:00 2001 From: mpl Date: Wed, 27 Jun 2018 21:07:53 +0200 Subject: [PATCH] pkg/client: move upload test to pkg/test/integration In 877eafa49b2e88d9b0cdc87aaf0d194330a53533 , pkg/server started importing pkg/client , since the server has to be able to fetch blobs from a share claim of another server. This introduced a circular dependency in tests, as pkg/client/upload_test.go instantiates a server. As the test uses both a client and a server, and tests uploading between the two, it seems fitting to move it to pkg/test/integration, which breaks the circular dep. Change-Id: I2458ffd72912ff6e9c1a0f67e187d54cc895c2e9 --- pkg/{client => test/integration}/upload_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) rename pkg/{client => test/integration}/upload_test.go (93%) diff --git a/pkg/client/upload_test.go b/pkg/test/integration/upload_test.go similarity index 93% rename from pkg/client/upload_test.go rename to pkg/test/integration/upload_test.go index 05486a63f..486e3e34c 100644 --- a/pkg/client/upload_test.go +++ b/pkg/test/integration/upload_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package client +package integration import ( "context" @@ -28,6 +28,7 @@ import ( "time" "perkeep.org/internal/osutil" + "perkeep.org/pkg/client" "perkeep.org/pkg/schema" "perkeep.org/pkg/serverinit" "perkeep.org/pkg/types/serverconfig" @@ -71,7 +72,7 @@ func TestUploadFile(t *testing.T) { ts := newTestServer(t) defer ts.Close() - c := NewOrFail(OptionServer(ts.URL)) + c := client.NewOrFail(client.OptionServer(ts.URL)) f := newFakeFile("foo.txt", "bar", time.Date(2011, 1, 28, 2, 3, 4, 0, time.Local)) @@ -88,10 +89,10 @@ func TestUploadFile(t *testing.T) { } // testUploadFile uploads a file and checks if it can be retrieved. -func testUploadFile(t *testing.T, c *Client, f *fakeFile, withFileOpts bool) *schema.Blob { - var opts *FileUploadOptions +func testUploadFile(t *testing.T, c *client.Client, f *fakeFile, withFileOpts bool) *schema.Blob { + var opts *client.FileUploadOptions if withFileOpts { - opts = &FileUploadOptions{FileInfo: f} + opts = &client.FileUploadOptions{FileInfo: f} } bref, err := c.UploadFile(ctxbg, f.Name(), strings.NewReader(f.content), opts) if err != nil {