1
0
mirror of https://github.com/xorcare/testing-go-code-with-postgres.git synced 2024-12-24 16:28:34 +02:00
Commit Graph

67 Commits

Author SHA1 Message Date
dependabot[bot]
f740dee6ec
Bump github.com/stretchr/testify from 1.9.0 to 1.10.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 23:51:49 +00:00
dependabot[bot]
6ee7987fc9
Bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 23:46:23 +00:00
Vasiliy Vasilyuk
a2d02fb915 Fix linter issues and simplify yaml files 2024-10-06 16:45:19 +03:00
Vasiliy Vasilyuk
b7eb482b87 Add linter 'gofumpt' 2024-10-06 16:11:54 +03:00
Vasiliy Vasilyuk
3bb9df005e
Add timeout for jobs in .gitlab-ci.yml 2024-10-03 22:23:31 +03:00
dependabot[bot]
6d5bcd13ad Bump github.com/jackc/pgx/v5 from 5.7.0 to 5.7.1
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.7.0 to 5.7.1.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.7.0...v5.7.1)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-17 08:14:39 +03:00
Vasiliy Vasilyuk
1e275839f4 Remove GitHub Workflow for mirroring to Gitlab
There was an advent recently, the Pipelines in Gitlab took a very long
time to execute, and used up my entire quota of free runners. At first
I thought of just adding timeouts, but then I thought there might be
better approaches to integrating with Gitlab.

So I'm removing the Gitlab integration for now, maybe in the future
when quotas are restored I'll set up a more convenient and thoughtful
integration again.
2024-09-14 14:57:29 +03:00
dependabot[bot]
1023c345c2 Bump github.com/golang-migrate/migrate/v4 from 4.17.1 to 4.18.1
Bumps [github.com/golang-migrate/migrate/v4](https://github.com/golang-migrate/migrate) from 4.17.1 to 4.18.1.
- [Release notes](https://github.com/golang-migrate/migrate/releases)
- [Changelog](https://github.com/golang-migrate/migrate/blob/master/.goreleaser.yml)
- [Commits](https://github.com/golang-migrate/migrate/compare/v4.17.1...v4.18.1)

---
updated-dependencies:
- dependency-name: github.com/golang-migrate/migrate/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-10 18:30:15 +03:00
dependabot[bot]
d447f3940d Bump github.com/jackc/pgx/v5 from 5.6.0 to 5.7.0
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.6.0 to 5.7.0.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.6.0...v5.7.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-10 18:27:29 +03:00
Vasiliy Vasilyuk
4d793253e8 Remove trigger of Gitlab sync for merge requests
Duplicate triggers cause problems, so only the push trigger is left.
2024-07-01 22:55:45 +03:00
Vasiliy Vasilyuk
593bc9715c Add example of tests with isolated schema 2024-07-01 21:02:04 +03:00
Vasiliy Vasilyuk
05d30f6c09 Add example of tests with transactional cleanup 2024-07-01 21:02:04 +03:00
Vasiliy Vasilyuk
13e3596692 Rename function for isolated database connection
Other ways to clean the database in tests will be added soon, so the
tests are being moved to a separate file.
2024-07-01 21:02:04 +03:00
Vasiliy Vasilyuk
83b2f61e41 Add interface do DB driver to repository
This abstraction is needed to add transactional cleanup in the future.
2024-07-01 21:02:04 +03:00
Vasiliy Vasilyuk
912e9c9ab0 Migrate to sql.DB driver
This is to reduce dependency on a particular driver. In the future this
will be used to implement different ways of cleaning the database.
2024-07-01 21:02:04 +03:00
Vasiliy Vasilyuk
883c9e0805 Add cleanup and format go.mod and go.sum to target 'check' 2024-07-01 21:02:04 +03:00
Vasiliy Vasilyuk
bfd3d587d9 Add '.PHONY' label for 'tools' target 2024-07-01 21:02:04 +03:00
Vasiliy Vasilyuk
ca16e02007
Enable linter 'wsl'
This is a highly controversial linter, but it generally has a positive
effect on code readability.
2024-06-30 22:41:56 +03:00
Vasiliy Vasilyuk
4544829f9b
Configure linter 'goimports' 2024-06-30 22:41:56 +03:00
Vasiliy Vasilyuk
4ccac3351d
Configure linter 'unused'
These settings allow you to find more unused code.
2024-06-30 22:41:44 +03:00
dependabot[bot]
e9faf17bba Bump github.com/jackc/pgx/v5 from 5.5.5 to 5.6.0
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.5.5 to 5.6.0.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.5.5...v5.6.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-29 07:05:09 +03:00
dependabot[bot]
1dfd46ede5 Bump golangci/golangci-lint-action from 5 to 6
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 5 to 6.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-14 19:06:16 +03:00
dependabot[bot]
feac4da676 Bump golangci/golangci-lint-action from 4 to 5
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 4 to 5.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 11:26:32 +03:00
dependabot[bot]
60060cb558 Bump github.com/jackc/pgx/v5 from 5.5.4 to 5.5.5
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.5.4 to 5.5.5.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.5.4...v5.5.5)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-14 19:32:46 +03:00
dependabot[bot]
2d6f8b6c3f
Bump github.com/stretchr/testify from 1.8.4 to 1.9.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-05 18:10:40 +00:00
dependabot[bot]
7325c3ebd9
Bump github.com/jackc/pgx/v5 from 5.5.3 to 5.5.4
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.5.3 to 5.5.4.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.5.3...v5.5.4)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 23:26:11 +00:00
dependabot[bot]
6e76b3e31e Bump golangci/golangci-lint-action from 3 to 4
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3 to 4.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-11 20:56:38 +03:00
Vasiliy Vasilyuk
66d4c714c4
Update .editorconfig and reformat code
The settings for yaml files regularly get confused and I don't like it,
so I add them to .editorconfig to make the settings always the same.
2024-02-11 20:50:44 +03:00
Vasiliy Vasilyuk
47add2b272
Bump go from 1.20 to 1.22.0 in .gitlab-ci.yml 2024-02-08 22:44:02 +03:00
Vasiliy Vasilyuk
5514fbebff
Add check actuality of go.mod and go.sum 2024-02-08 22:41:32 +03:00
Vasiliy Vasilyuk
c0e268facd
Bump go from 1.20 to 1.22.0 2024-02-08 22:27:46 +03:00
dependabot[bot]
742aa107ed
Bump github.com/jackc/pgx/v5 from 5.5.2 to 5.5.3
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.5.2 to 5.5.3.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.5.2...v5.5.3)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 22:22:20 +00:00
dependabot[bot]
4ff06a8f9c
Bump actions/setup-go from 4 to 5
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 22:19:39 +00:00
dependabot[bot]
a6799aa01b
Bump codecov/codecov-action from 3 to 4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 21:17:49 +00:00
Vasiliy Vasilyuk
9d545d0bad
Update go.yml
Updated the Go version to bring it up to date and cleaned up
unnecessary parameters.

Added the ability to manually run workflow, as it is very handy.
2024-02-07 00:15:48 +03:00
Vasiliy Vasilyuk
9300bb3bf8
Add dependabot config for github-actions
This is to automate the updating of CI components, and remember to keep
CI up to date on a regular basis.
2024-02-07 00:12:29 +03:00
Vasiliy Vasilyuk
c4aab04f0b
Make Gitlab mirroring great again
The https mirroring is broken for some reason. Since I don't need to
manually start CI anymore, I made mirroring via SSH.
2024-02-07 00:04:22 +03:00
Vasiliy Vasilyuk
82f4ebc0f9
Add dependabot configuration
For monitoring vulnerabilities in dependencies used in project and keep
dependencies up-to-date with Dependabot.

And also to remember to keep the repository up to date.
2024-01-27 16:01:50 +03:00
Vasiliy Vasilyuk
536cbe330b
Bump github.com/jackc/pgx/v5 to v5.5.2 2024-01-27 00:21:02 +03:00
Vasiliy Vasilyuk
942d210bb3
Bump github.com/google/uuid to v1.6.0 2024-01-27 00:20:46 +03:00
Vasiliy Vasilyuk
f8cba15b0d
Add known issue with colima
This problem is caused by incorrect mounting of files.

```
/var/folders/3p/glp5vp4916n03wmjh_b0gf6m0000gn/T/tmp.ib2dU9TY
❯ git clone https://github.com/xorcare/testing-go-code-with-postgres
cd testing-go-code-with-postgres
make test-env-up test
Cloning into 'testing-go-code-with-postgres'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (66/66), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 124 (delta 36), reused 51 (delta 30), pack-reused 58
Receiving objects: 100% (124/124), 31.92 KiB | 4.56 MiB/s, done.
Resolving deltas: 100% (50/50), done.
[+] Building 0.0s (0/0)                                                              docker:default
[+] Running 2/0
 ✔ Container testing-go-code-with-postgres-postgres-1  Recreated                               0.0s
 ✔ Container testing-go-code-with-postgres-migrate-1   Recreated                               0.0s
Attaching to testing-go-code-with-postgres-migrate-1
dependency failed to start: container testing-go-code-with-postgres-postgres-1 exited (126)
make: *** [test-env-up] Error 1
```

```
/var/folders/3p/glp5vp4916n03wmjh_b0gf6m0000gn/T/tmp.ib2dU9TY/testing-go-code-with-postgres
❯ docker-compose up
[+] Building 0.0s (0/0)                                                              docker:default
[+] Running 1/0
 ✔ Container testing-go-code-with-postgres-postgres-1  Created                                 0.0s
Attaching to testing-go-code-with-postgres-migrate-1, testing-go-code-with-postgres-postgres-1
testing-go-code-with-postgres-postgres-1  | The files belonging to this database system will be owned by user "postgres".
testing-go-code-with-postgres-postgres-1  | This user must also own the server process.
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  | The database cluster will be initialized with locale "en_US.utf8".
testing-go-code-with-postgres-postgres-1  | The default database encoding has accordingly been set to "UTF8".
testing-go-code-with-postgres-postgres-1  | The default text search configuration will be set to "english".
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  | Data page checksums are disabled.
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
testing-go-code-with-postgres-postgres-1  | creating subdirectories ... ok
testing-go-code-with-postgres-postgres-1  | selecting dynamic shared memory implementation ... posix
testing-go-code-with-postgres-postgres-1  | selecting default max_connections ... 100
testing-go-code-with-postgres-postgres-1  | selecting default shared_buffers ... 128MB
testing-go-code-with-postgres-postgres-1  | selecting default time zone ... UTC
testing-go-code-with-postgres-postgres-1  | creating configuration files ... ok
testing-go-code-with-postgres-postgres-1  | running bootstrap script ... ok
testing-go-code-with-postgres-postgres-1  | sh: locale: not found
testing-go-code-with-postgres-postgres-1  | 2023-11-18 13:34:16.419 UTC [31] WARNING:  no usable system locales were found
testing-go-code-with-postgres-postgres-1  | performing post-bootstrap initialization ... ok
testing-go-code-with-postgres-postgres-1  | syncing data to disk ... ok
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  | Success. You can now start the database server using:
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  |     pg_ctl -D /var/lib/postgresql/data -l logfile start
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  | initdb: warning: enabling "trust" authentication for local connections
testing-go-code-with-postgres-postgres-1  | initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
testing-go-code-with-postgres-postgres-1  | waiting for server to start....2023-11-18 13:34:16.617 UTC [37] LOG:  starting PostgreSQL 15.3 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
testing-go-code-with-postgres-postgres-1  | 2023-11-18 13:34:16.619 UTC [37] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
testing-go-code-with-postgres-postgres-1  | 2023-11-18 13:34:16.620 UTC [40] LOG:  database system was shut down at 2023-11-18 13:34:16 UTC
testing-go-code-with-postgres-postgres-1  | 2023-11-18 13:34:16.622 UTC [37] LOG:  database system is ready to accept connections
testing-go-code-with-postgres-postgres-1  |  done
testing-go-code-with-postgres-postgres-1  | server started
testing-go-code-with-postgres-postgres-1  |
testing-go-code-with-postgres-postgres-1  | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/docker-multiple-databases.sh
testing-go-code-with-postgres-postgres-1  | /usr/local/bin/docker-entrypoint.sh: line 170: /docker-entrypoint-initdb.d/docker-multiple-databases.sh: Is a directory
testing-go-code-with-postgres-postgres-1 exited with code 126
dependency failed to start: container testing-go-code-with-postgres-postgres-1 exited (126)
```
2023-11-18 16:36:40 +03:00
Vasiliy Vasilyuk
ef4031f027
Allow running pipelines without merge request
This will allow me to pass CI checks without creating merge requests,
since I work alone there is no point in them.
2023-11-15 22:23:35 +03:00
Vasiliy Vasilyuk
ab5f864a78
Enable linter 'testpackage'
This will avoid testing private functions and methods.
2023-11-14 22:35:32 +03:00
Vasiliy Vasilyuk
b17c6166dd
Enable linter 'testifylint'
This will allow to avoid mistakes.
2023-11-14 22:35:32 +03:00
Vasiliy Vasilyuk
0339ceb25b
Bump golangci-lint to v1.55.2 2023-11-14 22:35:25 +03:00
Vasiliy Vasilyuk
8c686cca5c
Hide sample test titles with a spoiler 2023-11-14 21:29:32 +03:00
Vasiliy Vasilyuk
c41bbafb59
Add 'Quick start' to README.md 2023-11-14 21:26:04 +03:00
Vasiliy Vasilyuk
942c43a636
Replace 'Dash' with 'Hyphen'
That's a more correct title.
2023-10-11 20:26:28 +03:00
Vasiliy Vasilyuk
31d6570cd7
Fix command for teardown test env in GitHub Actions 2023-10-05 17:51:26 +03:00
Vasiliy Vasilyuk
e9de025f7e
Migrate to Compose V2
From July 2023 Compose V1 stopped receiving updates. It’s also no
longer available in new releases of Docker Desktop.

Compose V2, which was first released in 2020, is included with all
currently supported versions of Docker Desktop. It offers an improved
CLI experience, improved build performance with BuildKit, and continued
new-feature development.

See https://docs.docker.com/compose/migrate
See https://docs.docker.com/compose/reference
2023-09-22 22:16:15 +03:00