summaryrefslogtreecommitdiff
path: root/libnetwork/bitseq/sequence_test.go
Commit message (Collapse)AuthorAgeFilesLines
* libnetwork/bit{seq,map}: delete CheckConsistency()Cory Snider2023-01-271-30/+0
| | | | | | | | That method was only referenced by ipam.Allocator, but as it no longer stores any state persistently there is no possibility for it to load an inconsistent bit-sequence from Docker 1.9.x. Signed-off-by: Cory Snider <csnider@mirantis.com>
* libnetwork/config: remove vestiges of global scopeCory Snider2023-01-261-1/+1
| | | | | | | | | | | | | Without (*Controller).ReloadConfiguration, the only way to configure datastore scopes would be by passing config.Options to libnetwork.New. The only options defined which relate to datastore scopes are limited to configuring the local-scope datastore. Furthermore, the default datastore config only defines configuration for the local-scope datastore. The local-scope datastore is therefore the only datastore scope possible in libnetwork. Start removing code which is only needed to support multiple datastore scopes. Signed-off-by: Cory Snider <csnider@mirantis.com>
* libnetwork/bitseq: refactor in terms of bitmapCory Snider2023-01-201-1097/+29
| | | | Signed-off-by: Cory Snider <csnider@mirantis.com>
* libnetwork/bitseq: add marshal/unmarshal testsCory Snider2023-01-201-0/+64
| | | | | | | Catch any backwards-compatibility hazards with serialization of sequences early. Signed-off-by: Cory Snider <csnider@mirantis.com>
* refactor: move from io/ioutil to io and os packageEng Zer Jun2021-08-271-2/+1
| | | | | | | | The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* libnetwork: remove unused "testutils" importsSebastiaan van Stijn2021-08-181-1/+0
| | | | | | | Perhaps the testutils package in the past had an `init()` function to set up specific things, but it no longer has. so these imports were doing nothing. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Fixup libnetwork lint errorsBrian Goff2021-06-011-1/+1
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Fix issues running libnetwork tests.Brian Goff2021-06-011-6/+8
| | | | | | | | libnetwork does different stuff depending on if you are running the tests in a container or not... without telling it we are in a container a bunch of the tests actually fail. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Fix libnetwork importsBrian Goff2021-06-011-2/+2
| | | | | | | | | After moving libnetwork to this repo, we need to update all the import paths for libnetwork to point to docker/docker/libnetwork instead of docker/libnetwork. This change implements that. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Fix gofmt in preparation of Go 1.13 updateSebastiaan van Stijn2020-02-271-8/+8
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* IPAM and Bitseq test casesAbhinandan Prativadi2018-03-091-6/+55
| | | | | | | This commit contains test cases to verify the changes and to solidify the library. Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
* Adding a unit case to verify rolloverAbhinandan Prativadi2017-10-031-145/+99
| | | | Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
* Minor unit test changeAbhinandan Prativadi2017-09-291-10/+192
| | | | | | | | Since bit allocation is no longer first available from the start some verfications are removed/modified to the change allocation model Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
* Adding a unit test to catch offset scenariosAbhinandan Prativadi2017-07-101-32/+72
| | | | Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
* Remove unnecessary string formatsKe Li2016-11-221-8/+8
| | | | Signed-off-by: Ke Li <kel@splunk.com>
* Fix bitseq.SetAnyInRangeAlessandro Boch2016-09-131-4/+5
| | | | | | - size 1 range is a valid input Signed-off-by: Alessandro Boch <aboch@docker.com>
* Remove kvstore deps from datastore packageJana Radhakrishnan2016-04-151-0/+5
| | | | | | | | | Currently datastore has dependencies on various kv backends. This is undesirable if datastore had to be used as a backend agnostic store management package with it's cache layer. This PR aims to achieve that. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
* Use gofmt with -s instead of goimportsVincent Demeester2016-02-121-3/+3
| | | | Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Allow bitseq caller to run consistency checkAlessandro Boch2016-01-141-0/+148
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* Increase test coverage in bitsequenceAlessandro Boch2015-12-111-1/+235
| | | | | | - Cover random allocation/deallocation Signed-off-by: Alessandro Boch <aboch@docker.com>
* Adjust ipam errorsAlessandro Boch2015-12-021-3/+3
| | | | | | | | | | | | | | | | - Remove from contract predefined errors which are no longer valid (ex. ErrInvalidIpamService, ErrInvalidIpamConfigService) - Do not use network driver error for ipam load failure in controller.go - Bitseq to expose two well-known errors (no more bit available, bit is already set) - Default ipam to report proper well-known error on RequestAddress() based on bitseq returned error - Default ipam errors to comply with types error interface Signed-off-by: Alessandro Boch <aboch@docker.com>
* Fix bug in bitsequence.pushReservationAlessandro Boch2015-11-241-0/+111
| | | | | | | | | | | | | | | | - pushReservation fails to correctly detect when the affected block is the last in the current sequence. It thinks instead the block is in between the sequence. Because of this a couple of issues may happen: 1. The allocation of the last bit causes the creation of a phantom sequence (length 0) at the end. (This has no side effects). 2. The allocation of a bit somewhere in the middle of the bitmask may lead to a completely incorrect sequence pattern. Signed-off-by: Alessandro Boch <aboch@docker.com>
* Remove 2^32 bits restriction on bitsequenceAlessandro Boch2015-10-101-27/+27
| | | | | | | - Allow bitsequence of length 2^64-1 - Updated ID Manager and IPAM Signed-off-by: Alessandro Boch <aboch@docker.com>
* Allow to set bits in a range in bitseqAlessandro Boch2015-09-181-38/+178
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* Move test specific functions to a testutils package.David Calavera2015-09-071-1/+1
| | | | | | | | | This way we won't vendor test related functions in docker anymore. It also moves netns related functions to a new ns package to be able to call the ns init function in tests. I think this also helps with the overall package isolation. Signed-off-by: David Calavera <david.calavera@gmail.com>
* bitseq to provide atomic functionsAlessandro Boch2015-08-161-59/+126
| | | | | | - Also add validation for passed ordinal Signed-off-by: Alessandro Boch <aboch@docker.com>
* bitseq to only handle and return unsigned typesAlessandro Boch2015-08-161-45/+45
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* Control exported types in bitseqAlessandro Boch2015-08-161-273/+274
| | | | | | - bitseq users only need to know Handle type Signed-off-by: Alessandro Boch <aboch@docker.com>
* network byte order to bitseq serializerAlessandro Boch2015-08-161-0/+2
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* Rework push reservation w/ datastoreAlessandro Boch2015-06-171-0/+52
| | | | | | | | | | - At Handle creation, first check if an instance of the the respective object is already present in the datastore. - Handle sequence must be saved only if commit to datastore is succesfull - Caller (ipam) needs to manage the retry Signed-off-by: Alessandro Boch <aboch@docker.com>
* Add numerical ids managerAlessandro Boch2015-06-171-2/+2
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* Add serialize/deserialize for sequence listAlessandro Boch2015-06-171-0/+42
| | | | Signed-off-by: Alessandro Boch <aboch@docker.com>
* Add bitseq packageAlessandro Boch2015-06-171-0/+333
- Initial version - It allows handling reservation/release of a finite set of resources through large bitmask. - It represents the bitmask as a list of equal consecutive 32 bits long bitmask symbols. It basically operates on a run-length encoding of the bitmask without encode/decode processing. Signed-off-by: Alessandro Boch <aboch@docker.com>