Commit graph

629 commits

Author SHA1 Message Date
Olivier Gambier
c7dc83442b Merge pull request #835 from stevvooe/next-generation
Lock down HTTP API error codes
2014-12-10 13:23:06 -08:00
Stephen J Day
7b56d10076 Lock down HTTP API error codes
This commit locks down the set of http error codes that will be part of the
inital V2 specification, proposed in docker/docker#9015. The naming order has
been slightly changed and there are few tweaks to ensure all conditions are
captured but this will be set the docker core will be impleemnted against.

To support this, the errors have been moved into an api/errors package. A new
type, ErrorDescriptor, has been defined to centralize the code, message and
definitions used with each type. The information therein can be used to
generate documentation and response code mappings (yet to come...).

In addition to the refactoring that came along with this change, several tests
have been added to ensure serialization round trips are reliable. This allows
better support for using these error types on the client and server side. This
is coupled with some tweaks in the client code to fix issues with error
reporting.

Other fixes in the client include moving client-specific errors out of the base
package and ensuring that we have correct parameters for finishing uploads.
2014-12-10 11:49:04 -08:00
Stephen J Day
33d89b4bca Disabling go vet until we get bug fixed 2014-12-10 11:41:49 -08:00
Stephen Day
0317f17c41 Merge pull request #837 from BrianBland/ng-storagedriver-tests
Various storagedriver test additions/improvements
2014-12-10 11:28:39 -08:00
Brian Bland
8a555bbb5f Attempts to fix go vet for circle 2014-12-10 11:12:47 -08:00
Brian Bland
9297693675 Improves storagedriver concurrency testing
Creates trees instead of flat files for TestConcurrentFileStreams

Adds TestConcurrentStreamReads, which writes a large file (smaller in
Short mode), and then ensures that several concurrent readers properly
read their portions of the file with random offsets
2014-12-10 10:57:47 -08:00
Brian Bland
cb25cc65bf Fixes storagedriver Stat test
Checks Stat on the directory before creating the file to make sure that
it does not exist
Properly cleans up after the test.
2014-12-10 10:55:33 -08:00
Brian Bland
14a072cd5f Improves storagedriver tests for Move command semantics
Ensures that Move will properly overwrite the file at the destination
location.
Also checks that Move of a nonexistent source file will NOT delete the
file at the destination.
2014-12-10 10:53:51 -08:00
Brian Bland
bbf288a808 Adds another error test case for reading nonexistent files 2014-12-10 10:51:07 -08:00
Olivier Gambier
8dcec82212 Update LICENSE 2014-12-10 10:10:20 -08:00
Stephen Day
12326f7090 Merge pull request #834 from stevvooe/next-generation
Implement tags HTTP API handler
2014-12-09 21:02:59 -08:00
Stephen Day
043c81bea2 Merge pull request #832 from BrianBland/ng-storagedriver-tests
Updates storagedriver tests to better test directory trees
2014-12-09 21:01:40 -08:00
Brian Bland
d375e264e1 Makes circle.yml run tests with the "-test.short" flag
This is due to longer tests which require more storage/memory than is
granted to us by the circle test runner vms.
2014-12-09 18:04:05 -08:00
Brian Bland
94052ea213 Fixes normalization of inmemory file paths
A normalized path always begins with "/" and never has a trailing slash
unless it is the root directory.
2014-12-09 17:20:10 -08:00
Stephen J Day
722ca35841 Test Tags HTTP API methods during manifest upload 2014-12-09 15:36:26 -08:00
Stephen J Day
10e5276c0e Add error code for unknown repository 2014-12-09 14:19:38 -08:00
Stephen J Day
33b2b80a8c Remove errant log message 2014-12-09 14:19:07 -08:00
Stephen J Day
49d13f9a08 Move manifest store errors to where they happen 2014-12-09 13:40:44 -08:00
Stephen J Day
6cbd22c5f0 Implement tags HTTP API handler 2014-12-09 13:38:07 -08:00
Stephen J Day
c71089c653 Implement Tags method on ManifestService 2014-12-09 13:37:21 -08:00
Olivier Gambier
a8ecb17d7e Merge pull request #833 from stevvooe/next-generation
Address bug in inmemory filesystem WriteAt method
2014-12-09 00:56:32 -08:00
Stephen J Day
45c29be442 Address bug in inmemory filesystem WriteAt method 2014-12-08 21:08:07 -08:00
Brian Bland
cacf33ab62 Uses random paths with slashes for storagedriver tests, adds edge cases
This replaces only using flat filenames, to better test nested file
behaviors.
Fixed inmemory/mfs.go and filesystem/driver.go after finding bugs with
the new tests and test behavior.
2014-12-08 19:26:29 -08:00
Brian Bland
9e38ca2231 Runs s3 storagedriver tests against all regions (excluding gov) 2014-12-08 16:16:36 -08:00
Olivier Gambier
f3f70d151d Merge pull request #820 from stevvooe/ng-storagedriver-updates
StorageDriver interface changes and cleanup
2014-12-08 12:48:15 -08:00
Stephen J Day
e364e71aab Address go vet declaration issue in tests 2014-12-08 09:51:59 -08:00
Stephen J Day
e15e07cb40 Disable race detector during tests due to memory usage
The tests are using way too much memory with the race detector enabled causing
the build machines to fall over. Cursory profiling shows no leaks but it may
need a closer look. For now, it will be disabled but this cannot be permanent.
2014-12-05 20:22:36 -08:00
Stephen J Day
14e7adb3a0 Add documentation for (*DriverSuite).TestStatCall 2014-12-05 19:20:42 -08:00
Stephen J Day
a7017d6873 Merge branch 'next-generation' into ng-storagedriver-updates 2014-12-05 19:17:51 -08:00
Stephen Day
2ab1de344a Merge pull request #827 from stevvooe/circleci-setup
Use circleci for continuous builds
2014-12-05 19:17:01 -08:00
Stephen J Day
1a25a34c5d Use circleci for continuous builds 2014-12-05 19:12:33 -08:00
Stephen J Day
1a75fccb43 Address PathNotFoundError in (*manifestStore).Exists
Exists was returning an error when encountering a PathNotFoundError when it
should just return false without an error.
2014-12-05 14:34:54 -08:00
Stephen J Day
2f78886aac Disable s3 and ipc executable entry points 2014-12-05 14:34:22 -08:00
Stephen J Day
8cb0e3398c Disable s3, azure and ipc packages and testing
The packages causing build errors are being disabled for now to let us split up
the work in the different driver implementations without blocking integration
into the main branch. The s3 and azure implementations need some effort to add
Stat support. The ipc package needs that work plus some care around hanging
send calls.
2014-12-05 14:05:37 -08:00
Stephen J Day
d703a86a64 Add checks for ReadStream offset boundary conditions
Several checks for ReadStream with offset around boundary conditions were
missing. The new checks ensure negative offsets are detected and io.EOF is
returned properly when trying to read past the end of a file. The filesystem
and inmemory driver have been updated accordingly.

An outline of missing checks for List are also part of this commit. Action will
be taken here based on discussion in issue #819.
2014-12-05 11:46:41 -08:00
Stephen J Day
70ab06b864 Update storage package to use StorageDriver.Stat
This change updates the backend storage package that consumes StorageDriver to
use the new Stat call, over CurrentSize. It also makes minor updates for using
WriteStream and ReadStream.
2014-12-04 20:55:59 -08:00
Stephen J Day
2ebc373d91 Refactor inmemory driver for Stat and WriteStream methods
This change started out as simply updating the existing inmemory driver to
implement the new Stat call. After struggling with the map based
implementation, it has been refactored to be a tree-based implementation.

This process has exposed a few missing error cases in the StorageDriver API
that should be addressed in the coming weeks.
2014-12-04 20:25:14 -08:00
Stephen J Day
ab9570f872 Migrate filesystem driver to new storagedriver calls
The filesystem driver has been migrated to impleemnt the storagedriver
interface changes. Most interetingly, this provides a filesystem-based
implementation of the Stat driver call. With this comes some refactoring of
Reads and Write to be much simpler and more robust.

The IPC tests have been disabled to stability problems that we'll have to
troubleshoot at a later date.
2014-12-03 16:47:31 -08:00
Stephen J Day
2037b1d6bf Update testsuite with storagedriver interface changes
This change updates the testsuite to migrate to the new driver interface. This
includes the new Stat call, changes to int64 over uint64 and the changes to the
WriteStream signature. Several test cases have been added to vet
implementations against various assumptions.
2014-12-03 16:37:46 -08:00
Stephen J Day
2e3ecdca37 Remove size argument and using io.Reader for StorageDriver.WriteStream
We are change the the rpc call for WriteStream to not require the size
argument, opting to drive the process with io.Reader. The main issue was that
io.Reader may return io.EOF before reaching size, making the error handling
around this condition for callers more complex. To complement this, WriteStream
now returns the number of successfully written bytes.

The method no longer requires an io.ReadCloser, opting to require just an
io.Reader. This keeps the reader under the control of the caller, which
provides more flexibility.

This also begins to address some of the problems described in #791.
2014-12-02 21:47:28 -08:00
Stephen J Day
ac660e72bf Replace StorageLayer.CurrentSize interface call with Stat
To support single-flight Size and ModTime queries against backend storage file,
we are replacing the CurrentSize call with a Stat call. A FileInfo interface is
provided for backends to provide a type, with a default implementation called
FileInfoInternal, for use by driver implementations.

More work needs to follow this change to update all the driver implementations.
2014-12-02 21:00:42 -08:00
Stephen J Day
b047c92e1c Use sync.WaitGroup to control concurrent tests 2014-12-02 20:43:31 -08:00
Stephen J Day
66107df1af Use int64 for ReadStream and WriteStream offsets
This change brings the storagedriver API in line with the Go standard library's
use of int64 for offsets. The main benefit is simplicity in interfacing with
the io library reducing the number of type conversions in simple code.
2014-12-02 19:01:00 -08:00
Olivier Gambier
511827efe2 Merge pull request #801 from ahmetalpbalkan/next-generation-azure-storagedriver
NG: Microsoft Azure storage driver
2014-12-02 13:45:52 -08:00
Olivier Gambier
e0414278d3 Merge pull request #806 from stevvooe/ng-registry-main
NG: Add registry main cmd
2014-12-02 12:34:59 -08:00
Olivier Gambier
efa4e03519 Merge pull request #807 from stevvooe/ng-nonzero-exit-error
StorageDrivers should exit non-zero on error (closes #803)
2014-12-02 12:33:08 -08:00
Olivier Gambier
fc1db3ad10 Merge pull request #805 from stevvooe/ng-manifest-bugs
NG: Various Manifest Oriented bugfixes
2014-12-01 18:45:12 -08:00
Ahmet Alp Balkan
4054cd3e73 Azure storage driver implementation
Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
2014-12-01 18:38:23 -08:00
Stephen J Day
54c0290cda StorageDrivers should exit non-zero on error (closes #803) 2014-12-01 18:25:10 -08:00
Stephen J Day
17b32e0aa0 Add TODO about manifest tampering test 2014-12-01 17:40:14 -08:00