-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(push): add import types for push (#66)
* feat(push): add import types for push * fix(import): read correct value * fix(import): add venom test * fix(import): fix venom test * feat(import): switch raw type * fix(import): fix venom test * fix(import): lint and error checking * feat(import): use correct value for import * test(import): fix venom test + changelog Co-authored-by: Adrien Aury <[email protected]> Co-authored-by: Adrien Aury <[email protected]>
- Loading branch information
1 parent
6182d90
commit e595fc9
Showing
6 changed files
with
186 additions
and
6 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
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
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
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
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
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,71 @@ | ||
# Copyright (C) 2021 CGI France | ||
# | ||
# This file is part of LINO. | ||
# | ||
# LINO is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# LINO is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with LINO. If not, see <http:#www.gnu.org/licenses/>. | ||
|
||
name: import different types | ||
testcases: | ||
- name: prepare test | ||
steps: | ||
# Clean working directory | ||
- script: rm -f * | ||
- script: lino dataconnector add --read-only source 'postgresql://postgres:sakila@source:5432/postgres?sslmode=disable' | ||
- script: lino dataconnector add dest 'postgresql://postgres:sakila@dest:5432/postgres?sslmode=disable' | ||
- script: lino relation extract source | ||
|
||
- name: export then import binary value | ||
steps: | ||
- script: |- | ||
cat > tables.yaml <<EOF | ||
version: v1 | ||
tables: | ||
- name: "staff" | ||
keys: | ||
- "staff_id" | ||
columns: | ||
- name: "staff_id" | ||
- name: "picture" | ||
export: "base64" | ||
EOF | ||
- script: lino pull source --filter staff_id=1 --table staff | lino push update dest --table staff | ||
- script: lino pull dest --filter staff_id=1 --table staff | ||
assertions: | ||
- result.systemerr ShouldBeEmpty | ||
- result.code ShouldEqual 0 | ||
- result.systemout ShouldEqual {"staff_id":1,"picture":"iVBORw0KWgo="} | ||
|
||
- name: export to different format than stored in datasource | ||
steps: | ||
- script: lino table extract source | ||
- script: lino pull source --table customer --limit 0 | lino push truncate dest --table customer | ||
- script: |- | ||
cat > tables.yaml <<EOF | ||
version: v1 | ||
tables: | ||
- name: customer | ||
keys: | ||
- customer_id | ||
columns: | ||
- name: "customer_id" | ||
- name: "create_date" | ||
export: "timestamp" | ||
import: "time.Time" | ||
EOF | ||
- script: lino pull source --table customer --filter customer_id=1 | lino push update dest --table customer | ||
- script: lino pull dest --table customer --filter customer_id=1 | ||
assertions: | ||
- result.systemerr ShouldBeEmpty | ||
- result.code ShouldEqual 0 | ||
- result.systemout ShouldEqual {"customer_id":1,"create_date":1139875200} |