Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Postgres Backup S3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Circles
Postgres Backup S3
Commits
5ce4ac7f
Commit
5ce4ac7f
authored
1 year ago
by
Elliott Shugerman
Browse files
Options
Downloads
Patches
Plain Diff
misc
parent
2374a8e9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.dir-locals.el
+4
-1
4 additions, 1 deletion
.dir-locals.el
test/test.janet
+23
-24
23 additions, 24 deletions
test/test.janet
with
27 additions
and
25 deletions
.dir-locals.el
+
4
−
1
View file @
5ce4ac7f
;;; Directory Local Variables -*- no-byte-compile: t -*-
;;; For more information see (info "(emacs) Directory Variables")
((
sh-mode
.
((
sh-basic-offset
.
2
))))
((
nil
.
((
eval
.
(
advice-add
'inf-janet-project-root
:filter-return
(
lambda
(
path
)
(
f-join
path
"test"
))))))
(
sh-mode
.
((
sh-basic-offset
.
2
))))
This diff is collapsed.
Click to expand it.
test/test.janet
+
23
−
24
View file @
5ce4ac7f
...
...
@@ -10,25 +10,6 @@
(
def
postgres-password
"secret"
)
(
def
seed-database
"paila"
)
(
def
base-env
{
"POSTGRES_CONTAINER_NAME"
postgres-container-name
"BACKUP_SERVICE_CONTAINER_NAME"
backup-service-container-name
"POSTGRES_USER"
postgres-user
"POSTGRES_PASSWORD"
postgres-password
"SEED_DATABASE"
seed-database
})
(
def
version-pairs
[{
"POSTGRES_VERSION"
"12"
"ALPINE_VERSION"
"3.12"
}
{
"POSTGRES_VERSION"
"13"
"ALPINE_VERSION"
"3.14"
}
{
"POSTGRES_VERSION"
"14"
"ALPINE_VERSION"
"3.16"
}
{
"POSTGRES_VERSION"
"15"
"ALPINE_VERSION"
"3.17"
}
# {"POSTGRES_VERSION" "16" "ALPINE_VERSION" "3.19"}
])
(
defn
export-env
[
env
]
(
loop
[[
name
val
]
:pairs
env
]
(
os/setenv
name
val
)))
(
defn
create-services
[]
(
print
"Creating services"
)
(
sh/$
docker
compose
--progress=plain
up
--build
--detach
))
...
...
@@ -82,13 +63,32 @@
arr
))
(
defn
assert-test-db-dne
[]
# TODO: make this do what the name says more directly
(
let
[
rows
(
exec-sql
:sql
"
\\
l"
:database
"postgres"
)
dbs
(
map
(
fn
[
db
]
(
db
:Name
))
rows
)]
(
is
(
not
(
includes
dbs
seed-database
)))))
(
defn
export-env
[
env
]
(
loop
[[
name
val
]
:pairs
env
]
(
os/setenv
name
val
)))
# (def version-pairs
# [{"POSTGRES_VERSION" "12" "ALPINE_VERSION" "3.12"}
# {"POSTGRES_VERSION" "13" "ALPINE_VERSION" "3.14"}
# {"POSTGRES_VERSION" "14" "ALPINE_VERSION" "3.16"}
# {"POSTGRES_VERSION" "15" "ALPINE_VERSION" "3.17"}
# {"POSTGRES_VERSION" "16" "ALPINE_VERSION" "3.19"}
# ])
(
defn
full-test
[
postgres-version
alpine-version
]
(
let
[
env
(
merge
base-env
{
"POSTGRES_VERSION"
postgres-version
"ALPINE_VERSION"
alpine-version
})]
(
let
[
base-env
{
"POSTGRES_CONTAINER_NAME"
postgres-container-name
"BACKUP_SERVICE_CONTAINER_NAME"
backup-service-container-name
"POSTGRES_USER"
postgres-user
"POSTGRES_PASSWORD"
postgres-password
"SEED_DATABASE"
seed-database
}
env
(
merge
base-env
{
"POSTGRES_VERSION"
postgres-version
"ALPINE_VERSION"
alpine-version
})]
# TODO: cleanup s3 (false negatives!)
(
export-env
env
)
(
delete-services
)
(
create-services
)
...
...
@@ -101,13 +101,12 @@
(
create-test-db
)
# restore needs it to already exist
(
restore
)
(
assert-test-db-populated
)
# asserts there's actually data in the table
(
delete-services
)
))
(
delete-services
)))
(
deftest
pg-12
(
full-test
"12"
"3.12"
))
(
deftest
pg-13
(
full-test
"13"
"3.14"
))
(
deftest
pg-14
(
full-test
"14"
"3.16"
))
(
deftest
pg-15
(
full-test
"1
4
"
"3.18"
))
(
deftest
pg-15
(
full-test
"1
5
"
"3.18"
))
(
run-tests!
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment