Externalize acceptance tests to wilhelm-vocabulary-acceptance-tests project (#117)
Browse files- .github/workflows/ci-cd.yaml +2 -6
- behave.ini +0 -4
- features/graphs.feature +0 -22
- features/steps/graphs.py +0 -74
.github/workflows/ci-cd.yaml
CHANGED
@@ -120,7 +120,7 @@ jobs:
|
|
120 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
121 |
|
122 |
docker:
|
123 |
-
name: Test Docker Build
|
124 |
needs: unit-tests
|
125 |
runs-on: ubuntu-latest
|
126 |
steps:
|
@@ -157,10 +157,6 @@ jobs:
|
|
157 |
NEO4J_DATABASE: ${{ env.NEO4J_DATABASE }}
|
158 |
NEO4J_USERNAME: ${{ env.NEO4J_USERNAME }}
|
159 |
NEO4J_PASSWORD: ${{ env.NEO4J_PASSWORD }}
|
160 |
-
- name: Install dependencies
|
161 |
-
run: pip3 install -r requirements.txt
|
162 |
-
- name: Run acceptance tests
|
163 |
-
run: behave -v
|
164 |
- name: Copy over data onto host
|
165 |
run: docker cp data-loader:/data .
|
166 |
- name: Test image build
|
@@ -200,5 +196,5 @@ jobs:
|
|
200 |
uses: peter-evans/repository-dispatch@v2
|
201 |
with:
|
202 |
token: ${{ secrets.QUBITPI_DOWNSTREAM_CICD_TRIGGERING_TOKEN }}
|
203 |
-
repository: QubitPi/wilhelm-
|
204 |
event-type: wilhelm-vocabulary-changes
|
|
|
120 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
121 |
|
122 |
docker:
|
123 |
+
name: Test Docker Build and Publish Data Image to DockerHub
|
124 |
needs: unit-tests
|
125 |
runs-on: ubuntu-latest
|
126 |
steps:
|
|
|
157 |
NEO4J_DATABASE: ${{ env.NEO4J_DATABASE }}
|
158 |
NEO4J_USERNAME: ${{ env.NEO4J_USERNAME }}
|
159 |
NEO4J_PASSWORD: ${{ env.NEO4J_PASSWORD }}
|
|
|
|
|
|
|
|
|
160 |
- name: Copy over data onto host
|
161 |
run: docker cp data-loader:/data .
|
162 |
- name: Test image build
|
|
|
196 |
uses: peter-evans/repository-dispatch@v2
|
197 |
with:
|
198 |
token: ${{ secrets.QUBITPI_DOWNSTREAM_CICD_TRIGGERING_TOKEN }}
|
199 |
+
repository: QubitPi/wilhelm-vocabulary-acceptance-tests
|
200 |
event-type: wilhelm-vocabulary-changes
|
behave.ini
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
[behave]
|
2 |
-
stdout_capture = no
|
3 |
-
stderr_capture = no
|
4 |
-
log_capture = no
|
|
|
|
|
|
|
|
|
|
features/graphs.feature
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
# Copyright Jiaqi Liu
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
Feature: Neo4J in Docker shows expected graphs
|
15 |
-
|
16 |
-
Scenario Outline: Vocabulary Linking
|
17 |
-
When we expand "<term>" by <hops> hops at most
|
18 |
-
Then we get these distinct nodes: <nodes>
|
19 |
-
|
20 |
-
Examples: Ancient Greek
|
21 |
-
| term | hops | nodes |
|
22 |
-
| δέ | 3 | {"aber lieber", "aber", "but", "sed", "ἀλλά", "δέ", "and", "τε", "et", "καί", "also", "even", "δ᾽"} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
features/steps/graphs.py
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
# Copyright Jiaqi Liu
|
2 |
-
#
|
3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
-
# you may not use this file except in compliance with the License.
|
5 |
-
# You may obtain a copy of the License at
|
6 |
-
#
|
7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
-
#
|
9 |
-
# Unless required by applicable law or agreed to in writing, software
|
10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
-
# See the License for the specific language governing permissions and
|
13 |
-
# limitations under the License.
|
14 |
-
import logging
|
15 |
-
|
16 |
-
from behave import then
|
17 |
-
from behave import when
|
18 |
-
from hamcrest import assert_that
|
19 |
-
from hamcrest import equal_to
|
20 |
-
from neo4j import GraphDatabase
|
21 |
-
|
22 |
-
# Set up the logging
|
23 |
-
logging.basicConfig(level=logging.INFO)
|
24 |
-
neo4j_logger = logging.getLogger("neo4j")
|
25 |
-
neo4j_logger.setLevel(logging.DEBUG) # Log all queries
|
26 |
-
|
27 |
-
|
28 |
-
@when('we expand "{term}" by {num_hops:d} hops at most')
|
29 |
-
def step_impl(context, term, num_hops):
|
30 |
-
driver = GraphDatabase.driver("neo4j://localhost:7687", auth=("not used", "not used"))
|
31 |
-
|
32 |
-
with driver.session() as session:
|
33 |
-
context.result = parse_apoc_path_expand_result(session.run(
|
34 |
-
"""
|
35 |
-
MATCH (node{label:$term})
|
36 |
-
CALL apoc.path.expand(node, "LINK", null, 1, $num_hops)
|
37 |
-
YIELD path
|
38 |
-
RETURN path;
|
39 |
-
""",
|
40 |
-
term=term,
|
41 |
-
num_hops=num_hops
|
42 |
-
))
|
43 |
-
|
44 |
-
|
45 |
-
@then('we get these distinct nodes: {nodes}')
|
46 |
-
def step_impl(context, nodes):
|
47 |
-
assert_that(set(context.result["nodes"]), equal_to(eval(nodes)))
|
48 |
-
|
49 |
-
|
50 |
-
def parse_apoc_path_expand_result(result):
|
51 |
-
nodes = set()
|
52 |
-
links = []
|
53 |
-
|
54 |
-
nodeMap = dict()
|
55 |
-
duplicateLinks = set()
|
56 |
-
for record in result:
|
57 |
-
path = record["path"]
|
58 |
-
|
59 |
-
for node in path.nodes:
|
60 |
-
label = dict(node)["label"]
|
61 |
-
nodes.add(label)
|
62 |
-
nodeMap[node.id] = label
|
63 |
-
|
64 |
-
for link in path.relationships:
|
65 |
-
if link.id not in duplicateLinks:
|
66 |
-
duplicateLinks.add(link.id)
|
67 |
-
|
68 |
-
links.append({
|
69 |
-
"source": nodeMap[link.start_node.id],
|
70 |
-
"target": nodeMap[link.end_node.id],
|
71 |
-
"label": dict(link)["label"],
|
72 |
-
})
|
73 |
-
|
74 |
-
return {"nodes": list(nodes), "links": links}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|