Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for spelling typos #44

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,36 @@ on:
jobs:
test:
name: Run tests and linters
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
LANG: en_US.utf8
DEBIAN_FRONTEND: noninteractive
PG_MAJOR: 15
PG_MAJOR: 17
container:
image: ubuntu:jammy
image: ubuntu:noble
steps:
- uses: actions/checkout@v3
- name: Set postgresql uid/gid
run: |
groupadd -r postgres --gid=999
useradd -r -d /var/lib/postgresql -g postgres --uid=999 postgres
- uses: actions/checkout@v4
- name: Set locale to utf-8
run: |
apt-get update
apt-get install -y ca-certificates locales
rm -rf /var/lib/apt/lists/*
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
- name: Install wget
run: |
apt-get install -y wget
rm -rf /var/lib/apt/lists/*
- name: Check for spelling typos
uses: crate-ci/typos@master
- name: Set postgresql uid/gid
run: |
groupadd -r postgres --gid=999
useradd -r -d /var/lib/postgresql -g postgres --uid=999 postgres
- name: Install PostgreSQL ${PG_MAJOR} and Python
run: |
echo 'deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
echo 'deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu/ jammy main' > /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa.list
echo 'deb http://apt.postgresql.org/pub/repos/apt/ noble-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
echo 'deb https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu/ noble main' > /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa.list
apt-get -o Acquire::AllowInsecureRepositories=true -o Acquire::AllowDowngradeToInsecureRepositories=true update
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -o APT::Get::AllowUnauthenticated=true install -y postgresql-common sudo libpq-dev python2.7-dev python3.11-dev python3.11-lib2to3 build-essential curl postgresql-$PG_MAJOR postgresql-contrib-$PG_MAJOR
apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -o APT::Get::AllowUnauthenticated=true install -y postgresql-common sudo libpq-dev python3.11-dev python3.11-lib2to3 build-essential curl postgresql-$PG_MAJOR postgresql-contrib-$PG_MAJOR
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.11 get-pip.py
pip3.11 install tox
Expand Down
2 changes: 1 addition & 1 deletion features/baseline.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Baseline
And database contains schema_version
And migration info contains forced baseline=3

Scenario: Setting baseline on noninitalized database
Scenario: Setting baseline on noninitialized database
Given migration dir
And database and connection
When we run pgmigrate with "-b 1 baseline"
Expand Down
2 changes: 1 addition & 1 deletion features/config.feature
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Feature: Getting info from config
| seq | op |
| 1 | After all |

Scenario: Callbacks from config are overrided by args
Scenario: Callbacks from config are overridden by args
Given migration dir
And migrations
| file | code |
Expand Down
6 changes: 3 additions & 3 deletions features/conflicting_pids.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Conflicting pids termination
| V3__Alter_test_table.sql | ALTER TABLE test ADD COLUMN test text; |
And database and connection
And successful pgmigrate run with "-t 2 migrate"
And not commited query "UPDATE test SET id = 2 WHERE id = 1"
And not committed query "UPDATE test SET id = 2 WHERE id = 1"
When we run pgmigrate with "-l 0.1 -t 3 migrate"
Then pgmigrate command "succeeded"

Expand All @@ -22,7 +22,7 @@ Feature: Conflicting pids termination
| V3__NONTRANSACTIONAL_migration.sql | ALTER TABLE test ADD COLUMN test text; |
And database and connection
And successful pgmigrate run with "-t 2 migrate"
And not commited query "UPDATE test SET id = 2 WHERE id = 1"
And not committed query "UPDATE test SET id = 2 WHERE id = 1"
When we run pgmigrate with "-l 0.1 -t 3 migrate"
Then pgmigrate command "succeeded"

Expand All @@ -35,6 +35,6 @@ Feature: Conflicting pids termination
And database and connection
And query "CREATE TABLE test (id bigint)"
And query "INSERT INTO test (id) VALUES (1)"
And not commited query "UPDATE test SET id = 2 WHERE id = 1"
And not committed query "UPDATE test SET id = 2 WHERE id = 1"
When we run pgmigrate with "-l 0.1 -t 2 migrate"
Then pgmigrate command "succeeded"
2 changes: 1 addition & 1 deletion features/errors_handle.feature
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Feature: Handling migration errors
When we run pgmigrate with "-n -t 2 migrate"
Then pgmigrate command "failed"
And database contains schema_version
And migrate command failed with is nonsence
And migrate command failed with is nonsense

Scenario: Nontransactional migration on empty database
Given migration dir
Expand Down
2 changes: 1 addition & 1 deletion features/steps/query.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from behave import given, then


@given('not commited query "{query}"') # noqa
@given('not committed query "{query}"') # noqa
def step_impl(context, query):
cur = context.conn.cursor()
cur.execute(query)
Expand Down
6 changes: 3 additions & 3 deletions pgmigrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,9 +764,9 @@ def migrate(config):
'Schema check is not available for nontransactional '
'migrations')
if config.dryrun:
LOG.error('Dry run for nontransactional migrations is nonsence')
LOG.error('Dry run for nontransactional migrations is nonsense')
raise MigrateError('Dry run for nontransactional migrations '
'is nonsence')
'is nonsense')
if len(state) != len(not_applied):
if len(not_applied) != len(non_trans):
LOG.error('Unable to mix transactional and '
Expand Down Expand Up @@ -916,7 +916,7 @@ def _main():
parser.add_argument('-l',
'--termination_interval',
type=float,
help='Inverval for terminating blocking pids')
help='Interval for terminating blocking pids')
parser.add_argument('-m', '--schema', type=str, help='Operate on schema')
parser.add_argument('--disable_schema_check',
action='store_true',
Expand Down