Commit Graph

29 Commits

Author SHA1 Message Date
Simone Gotti
eb9629d84d test: re-enable gofmt tests 2021-10-07 09:48:23 +02:00
Simone Gotti
771a8d3eaf *: update to go 1.14
* Update to go 1.14
* Update golangci-lint to v1.23.6 that works with go 1.14
2020-03-20 10:11:02 +01:00
Simone Gotti
adf3437d7e *: add support for PostgreSQL 12
PostgreSQL 12 changed how it manages recovery and standby:

* The "recovery.conf" file has been removed.
* Recovery parameters now live in "postgresql.conf"
* "standby_mode" recovery parameter has been removed.
* Two "signal" files ("recovery.signal" and "standby.signal") are used to define
  the recovery mode (instead of using a "recovery.conf" file + "standby_mode" parameter)
2019-11-19 13:35:23 +01:00
Simone Gotti
dec4a43398 *: use golangci-lint
* Run golangci-lint in test script
* Fix all linting errors
2019-10-22 10:51:36 +02:00
Simone Gotti
cad12a8229 Use a Makefile for all build tasks
Drop the build shell script and use a Makefile.
2019-10-11 17:22:24 +02:00
Simone Gotti
f7646f764f Use agola CI/CD
Implement initial run definition for agola CI/CD. It'll use the latest two go
versions (currently 1.12 and 1.13)

Add a test matrix for all the supported postgres version and stores (for etcdv2
and consul just test with the latest postgres version)

In future will add automatic docker example image build and push
2019-10-09 10:15:34 +02:00
Simone Gotti
157802bbaa *: update to go1.12
Update travis and use external go vet shadow tools since it's not included in
the go vet command
2019-05-27 15:21:32 +02:00
Dinesh
aecdb10906
source the readlinkdashf irrespective of CWD 2018-12-04 07:42:54 +05:30
Dinesh
577092c562 Make readlink work in osx for gen_commands_doc.sh 2018-11-25 00:32:55 +05:30
Simone Gotti
cfe1fd84de Merge pull request #554 from sgotti/test_go_fmt_only_latest_go_version
test: test gofmt only with the latest go version
2018-08-28 11:40:16 +02:00
Krishnaswamy Subramanian
cba5e6aae3
Use readlinkdashf in test for cross compatibility with osx
origin source: https://github.com/kubernetes/kubernetes/blob/master/hack/lib/init.sh#L102

Signed-off-by: Krishnaswamy Subramanian <jskswamy@gmail.com>
2018-08-28 08:56:45 +05:30
Simone Gotti
551149657e test: test gofmt only with the latest go version
since gofmt output may change between versions, only test gofmt with the latest
(currently go1.11) go version.
2018-08-27 14:02:13 +02:00
Simone Gotti
6f45fb8385 *: update go version to go1.11 and simplify build
* use go 1.10.x and 1.11.x on travis
* Remove the build hack that uses a local GOPATH:
  * Use `go_import_path` on travis and create a symlink to the main org repo on
  semaphore
  * Users forking stolon repo on github should just use git remotes in the main
  repo clone
* Remove messages to build a cgo enabled stdlib, go build cache introduced in go
1.10 also caches this.
* Always use `go build` instead of `go install` so we can directly place
binaries in the project bin dir and choose the binary name
2018-08-27 13:12:10 +02:00
Simone Gotti
19fa5615fe test: temporarily disable gofmt on CI
Temporarily disable gofmt on CI since it'll break when we'll use go 1.10 and go
1.11.

A possible solution could be to check against only one (usually the latest
stable) go version gofmt output (for example gofmt in go 1.10 and 1.11 will
format differently) or check that at least one passes.
2018-07-20 16:00:27 +02:00
Simone Gotti
2efc86e66a test: improve test script
test all the packages without the need to provide a list
2018-06-05 22:20:37 +02:00
Simone Gotti
5c85f9a1e8 tests: disable caching in integration tests
With go 1.10 integration tests will returns cached results since no test
code has changed.

Disable caching using the `-count 1` option.
2018-02-23 11:29:51 +01:00
Simone Gotti
e84ff2cda3 *: add support for etcd v3 api
for etcdv2 and consul we keep using libkv while for etcd v3 api we'll directly
use the etcdclientv3. We abstract the implementation under a KVStore and an
Election interface. We haven't implemented a libkv store for etcdv3 since libkv
looks quite dead and doesn't support the context package. So in future we'll
probably move out from libkv to better use context features.
2018-01-08 13:28:29 +01:00
Niklas Hambüchen
53ee1d0b75 scripts: Use /usr/bin/env bash instead of /bin/bash.
Same approach as is common for python.

Fixes builds on NixOS and other environments that guarantee
reproducible builds.
2017-07-14 14:19:53 +02:00
Simone Gotti
78ce43f487 *: report keeper and db states via store
The keeper and db states are reported using the store.

The keeper doesn't listen on a tcp port anymore since there isn't the
need to expose an api to query its state. The related options have been
removed (--port and --listen-address).

In addition, the kubernetes discovery has been removed since everything
is done using the store. The kubernetes discovery was quite complicated
and probably useful only for having the pod list from k8s and skip old
partitioned pods able to talk with the store. Probably this case is very
special and doesn't requires this sort of handling and can be generally
improved in future with additional checks (as a last resort a check that
does a k8s based filtering could be implemented).
Also the related sentinel options have been removed.
2016-11-22 15:00:59 +01:00
Simone Gotti
1b5da053c1 keeper: improve handling of previous postgresql.conf
Don't move previous postgresql.conf but start instance with a temporary
config file.

Save locally init parameters so they can be restored if the keeper is
restarted before the sentinel has moved the cluster status to normal
phase.

Use pg_file_settings when available (pg >= 9.5) to retrieve pg
parameters.

Improve and add tests.
2016-11-12 13:30:44 +01:00
Simone Gotti
e5b70cf768 Migrate to glide and go >= 1.5 vendoring.
Also update some libraries to their latest released version.

To update just change glide.yaml and run ./scripts/glide-update.sh.
2016-09-09 15:45:27 +02:00
Simone Gotti
0cde253eb9 keeper: resync from master only when needed.
Previously when switching an instance from master to standby role, a
full resync was always executed.

Sometimes an old master is on the same branch of the new one and can
become a standby without the need to full resync.
2016-03-16 11:16:46 +01:00
Simone Gotti
c6888387f8 Run tests in parallel
since some integration tests are quite long (minutes), run them in
parallel.

To avoid unreadable logging (due multiple tests running in parallel),
use only the `testing` pkg logging functions so the output will be shown
only on error or at the end of every test (since we pass `-v` to `go
test`).

By default 4 parallel tests will be run. The parallelism level can be
configured with the PARALLEL environment variable when invoking the test
script.
2016-03-14 14:11:51 +01:00
Simone Gotti
cbe0782446 stolon: support consul as a store.
This patch uses docker/libkv and swarm/leadership to also handle consul as a
stolon's store.

In future also zookeeper should be supported (needs testing).

Incompatible changes:

--etcd-endpoints option has been removed

--store-backend and --store-endpoints options has been added.
2016-01-25 18:33:06 +01:00
Simone Gotti
ea99cdf03a tests: start etcd inside tests.
Instead of relying on an already running etcd, start it in the tests.
2015-10-28 11:15:36 +01:00
Simone Gotti
0161b63977 *: Handle synchronous replication
Now users can define in the cluster config if they want synchronous
replication. When enabled the master server parameter `synchronous_standby_names`
will be set to the value of the followers defined in the cluster view.

Users can switch between async and sync replication at any time without the
need to restart anything.
2015-10-16 18:02:24 +02:00
Simone Gotti
afc98f855d test: move source checks before other tests. 2015-10-15 20:40:04 +02:00
Simone Gotti
490096b46d sentinel: Add initial updateClusterView tests.
Also add gofmt and go tool vet checks.
2015-10-12 17:40:08 +02:00
Simone Gotti
acc1527890 Initial Commit. 2015-10-09 16:08:27 +02:00