-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integration Test for PostgreSQL and Manticore using Docker (#93)
* Created test-postgres-docker.rec --------- Co-authored-by: Pavel_Shilin <work@pavelshilin.com>
- Loading branch information
1 parent
5e6f6a9
commit 141f7d8
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
\c api_db; | ||
|
||
CREATE TABLE a_block_element ( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR NOT NULL, | ||
text JSONB | ||
); | ||
|
||
INSERT INTO a_block_element (name, text) VALUES | ||
('Element 1', '{"key1": "value1"}'), | ||
('Element 2', '{"key2": "value2"}'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
source text_src { | ||
type = pgsql | ||
sql_host = postgres | ||
sql_user = postgres | ||
sql_pass = qazQASD! | ||
sql_db = api_db | ||
sql_port = 5432 | ||
sql_query = SELECT id, name from a_block_element | ||
} | ||
|
||
index text_idx { | ||
type = plain | ||
source = text_src | ||
path = /var/lib/manticore/data | ||
} | ||
|
||
searchd { | ||
listen = 127.0.0.1:9312 | ||
listen = 127.0.0.1:9306:mysql | ||
listen = 127.0.0.1:9308:http | ||
pid_file = /var/run/manticore/searchd.pid | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
––– block: ./base/init ––– | ||
––– input ––– | ||
docker network create app-network --driver bridge > /dev/null; echo $? | ||
––– output ––– | ||
0 | ||
––– input ––– | ||
docker run -d --name postgres --network app-network -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=qazQASD! -e POSTGRES_DB=api_db -p 5432:5432 -v $(pwd)/clt_tests/tests/base/init.sql:/docker-entrypoint-initdb.d/init.sql postgres:latest > /dev/null 2>&1; echo $? | ||
––– output ––– | ||
0 | ||
––– input ––– | ||
timeout 35 grep -m2 'database system is ready to accept connections' <(docker logs -f postgres 2>&1) | ||
––– output ––– | ||
#!/\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3}/!# UTC [%{NUMBER}] LOG: database system is ready to accept connections | ||
#!/\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3}/!# UTC [%{NUMBER}] LOG: database system is ready to accept connections | ||
––– input ––– | ||
docker run -d -e CREATE_PLAIN_TABLES=1 --name manticore --network app-network -v $(pwd)/clt_tests/tests/base/manticore-indexer-postgres.conf:/etc/manticoresearch/manticore.conf manticoresoftware/manticore:current | ||
––– output ––– | ||
#!/[0-9a-z]+/!# | ||
––– input ––– | ||
if timeout 60 grep -qm1 'accepting connections' <(docker logs -f manticore); then echo 'accepting connections'; else echo 'Manticore failed to start properly in 60 seconds'; fi | ||
––– output ––– | ||
accepting connections | ||
––– input ––– | ||
docker exec manticore mysql -h0 -P9306 -e "SHOW TABLES\G;" | ||
––– output ––– | ||
*************************** 1. row *************************** | ||
Index: text_idx | ||
Type: local | ||
––– input ––– | ||
docker exec manticore mysql -h0 -P9306 -e "SELECT * FROM text_idx\G;" | ||
––– output ––– | ||
*************************** 1. row *************************** | ||
id: 1 | ||
name: Element 1 | ||
*************************** 2. row *************************** | ||
id: 2 | ||
name: Element 2 |