1
0
mirror of https://github.com/xorcare/testing-go-code-with-postgres.git synced 2025-06-30 23:23:40 +02:00
Commit Graph

19 Commits

Author SHA1 Message Date
31d6570cd7 Fix command for teardown test env in GitHub Actions 2023-10-05 17:51:26 +03:00
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
d697a4bcc7 Make return the exit code of a 'migrate' service container
This will make it easier to debug problems, because if an error occurs,
it returns from docker-compose and interrupts the chain of commands,
for example:

make test-env-down test-env-up test
2023-08-20 16:46:23 +03:00
b98187650e Make human-readable database name
Sometimes tests terminate fatally and databases are not deleted and you
want to understand which test left garbage behind. It is also in the
future it will be possible to add the ability not to delete databases
for tests that ended with an error, and it will be necessary to
understand from which test the database.

Therefore, the generation of the database name from the name of the
test with the addition of a unique identifier so that the names do not
overlap.

    Reports the maximum identifier length. It is determined as one less
    than the value of NAMEDATALEN when building the server. The default
    value of NAMEDATALEN is 64; therefore the default
    max_identifier_length is 63 bytes, which can be less than 63
    characters when using multibyte encodings.

See https://www.postgresql.org/docs/15/runtime-config-preset.html

    PostgreSQL allows you to create any number of databases at a given
    site. Database names must have an alphabetic first character and
    are limited to 63 bytes in length. A convenient choice is to create
    a database with the same name as your current user name. Many tools
    assume that database name as the default, so it can save you some
    typing. To create that database, simply type:

See https://www.postgresql.org/docs/15/tutorial-createdb.html
2023-07-16 17:18:30 +03:00
cdd90f86db Fix placeholder for the database template name
When a template database name contains invalid characters such as `-`,
the request to create a new database stops working.

To reduce this behavior, quotation marks have been added.
2023-07-15 20:34:41 +03:00
c7a32b73ea Speed up your integration tests by one line 2023-07-14 17:46:23 +03:00
7613653f39 Add set of small fixes to testingpg package
Added some set of disparate improvements, to improve readability.
2023-07-13 21:24:03 +03:00
1957a32dcb Increase the maximum number of connections
This is to simplify testing using the `-count=100` option.
2023-07-12 22:40:49 +03:00
59c4d2e3e1 Make a singleton for *pgxpool.Pool
This should reduce the number of parasitic connection reopenings.
2023-07-12 22:40:44 +03:00
4bb736475b Make a lazy loading for opening a connection
In the current approach, the connection logic is only triggered at the
moment of immediate need for connection.

We also get a single connection opening point.
2023-07-12 22:17:11 +03:00
c2e0810c2c Update README.md 2023-07-11 23:15:26 +03:00
42815eab15 Add GitLab CI and mirroring to GitLab
Added an example .gitlab-ci.yml, to make a sample more informative.

Also added mirroring to gitlab to simplify repository development and
gitlab ci validation.
2023-07-11 22:53:23 +03:00
5fc60fb2f5 Add coverage report by Codecov
This is needed to display coverage, and as an example of setting up
coverage counts.

Also, added badges to make the repositories look prettier.
2023-07-10 23:36:05 +03:00
cfe9add3d7 Add lint to CI
It is necessary to remember not to bring the code to a state complying
with the rules.
2023-07-10 23:10:36 +03:00
f5f4e2ce8c Add GitHub actions workflow
This is necessary for the completeness of the example.
2023-07-10 22:52:46 +03:00
9cb6ced6ef Add parallel running for tests 2023-07-05 07:57:37 +03:00
fd50c57aff Mark tests as integration
It is necessary so that these tests will not run when using the
`make test-short` command.
2023-07-05 07:51:30 +03:00
b346272f7f Publish an example testing go code with Postgres 2023-07-05 01:31:59 +03:00
7e6770223e Initial commit 2023-06-17 16:29:50 +03:00