Skip to content

Commit 0ece753

Browse files
Test docs content in CI using antora (#1010)
## Goal Introduce an antora playbook for testing . Any pages from external modules which are referenced are mocked. ## Implementation * Move the code testing from `test` to `test/code` * Introduces the antora playbook file * Creates the `mock` folder. * Fixes any errors found along the way.
1 parent 182968a commit 0ece753

File tree

38 files changed

+134
-42
lines changed

38 files changed

+134
-42
lines changed

.factory/automation.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ config:
66
build:
77
correctness:
88

9+
test-docs-content:
10+
image: typedb-ubuntu-22.04
11+
type: foreground
12+
command: |
13+
npx antora generate test/content/antora-playbook-mock-for-ci.yml
14+
915
test-code-testing-framework:
1016
image: typedb-ubuntu-22.04
1117
type: foreground
@@ -16,15 +22,15 @@ build:
1622
# Note: Rust runners install their own dependencies
1723
sudo apt-get update
1824
sudo apt-get install -y python3-pip
19-
python3 -m pip install -r test/runners/python_requirements.txt
25+
python3 -m pip install -r test/code/runners/python_requirements.txt
2026
2127
test/start-community-server.sh
2228
2329
FAILED=false
24-
python3 -m test.main python test/tests/python_test.adoc || FAILED=true
25-
python3 -m test.main rust test/tests/rust_test.adoc || FAILED=true
26-
python3 -m test.main typeql test/tests/tql_test_linear.adoc || FAILED=true
27-
# python3 -m test.main typeql test/tests/tql_test_custom.adoc || FAILED=true
30+
python3 -m test.code.main python test/code/tests/python_test.adoc || FAILED=true
31+
python3 -m test.code.main rust test/code/tests/rust_test.adoc || FAILED=true
32+
python3 -m test.code.main typeql test/code/tests/tql_test_linear.adoc || FAILED=true
33+
# python3 -m test.code.main typeql test/code/tests/tql_test_custom.adoc || FAILED=true
2834
test/stop-community-server.sh
2935
$FAILED && exit 1
3036
@@ -39,7 +45,7 @@ build:
3945
# Note: Rust runners install their own dependencies
4046
sudo apt-get update
4147
sudo apt-get install -y python3-pip
42-
python3 -m pip install -r test/runners/python_requirements.txt
48+
python3 -m pip install -r test/code/runners/python_requirements.txt
4349
4450
test/start-community-server.sh
4551
@@ -51,7 +57,7 @@ build:
5157
FAILED=false
5258
for TEST_LANG in "${TEST_LANGS[@]}"; do
5359
for TEST_DIR in "${TEST_DIRS[@]}"; do
54-
python3 -m test.main "$TEST_LANG" "$TEST_DIR" || FAILED=true
60+
python3 -m test.code.main "$TEST_LANG" "$TEST_DIR" || FAILED=true
5561
done
5662
done
5763
test/stop-community-server.sh

academy/modules/ROOT/pages/5-defining-schemas/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Learn about how types and functions are validated against the schema.
4444
--
4545

4646
== Running examples
47-
48-
The sample database already has the complete bookstore schema defined and data inserted. If you would like to try running the Define queries featured in the examples and exercises in this section, then you should do so using another database. To create a new database, use the *database manager* image:{page-version}@home::studio-icons/svg/studio_dbs.svg[width=24]. After creation, make sure to switch over to it using the *database selector*. For more information on how to manage databases using TypeDB Studio, refer back to xref:{page-version}@academy::2-environment-setup/2.2-using-typedb-studio.adoc[Lesson 2.2]
47+
// There used to be a Lesson 2.2 on how to use studio. Until we have that, I'm linking out to the studio docs.
48+
The sample database already has the complete bookstore schema defined and data inserted. If you would like to try running the Define queries featured in the examples and exercises in this section, then you should do so using another database. To create a new database, use the *database manager* image:{page-version}@home::studio-icons/svg/studio_dbs.svg[width=24]. After creation, make sure to switch over to it using the *database selector*. For more information on how to manage databases using TypeDB Studio, refer back to the xref:{page-version}@tools::studio.adoc[TypeDB studio reference].
4949

5050
To run a Define query, make sure to use a *schema* session and *write* transaction. After running a Define query, you should see any committed changes to the schema reflected in the *type browser*. The examples and exercises featured in this lesson are annotated with one of the following instructions to indicate how they should be run.
5151

academy/modules/ROOT/pages/5-defining-schemas/summary.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Learn how to build applications on TypeDB, covering database management, transac
121121
Learn how to build query patterns utilising advanced elements of TypeQL syntax, and how queries are resolved by TypeDB.
122122
****
123123

124-
.xref:{page-version}@manual::defining/index.adoc[Manual: Defining schemas]
124+
.xref:{page-version}@typeql-reference::schema/index.adoc[Reference: Defining schemas]
125125
[.clickable]
126126
****
127127
Learn more about defining schemas for TypeDB, covering Define queries, Undefine queries, and schema editing.

academy/modules/ROOT/pages/7-understanding-query-patterns/summary.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Learn how to structure query results in the optimal manner, covering result grou
125125
Learn how to design schemas for TypeDB using the conceptual PERA model, including common design patterns and pitfalls.
126126
****
127127

128-
.xref:{page-version}@typeql::patterns/index.adoc[Reference: Patterns]
128+
.xref:{page-version}@typeql-reference::patterns/index.adoc[Reference: Patterns]
129129
[.clickable]
130130
****
131131
Read the TypeQL patterns reference, covering conjunctions, disjunctions, negations, and pattern matching behaviour.

academy/modules/ROOT/pages/9-modeling-schemas/summary.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ image::academy::typeql-terminology.png[role=framed, width = 75%, link=self]
4949
* A simple contract can be created by making a type abstract, and implementing abstract interfaces
5050
* Contact us if you're interested in 'strict' contracts
5151

52-
== xref:{page-version}@academy::9-modeling-schemas/9.9-specializations.adoc[Specialization]
52+
== xref:{page-version}@academy::9-modeling-schemas/9.9-specialization.adoc[Specialization]
5353

5454
* Redeclaring schema definitions is normally disallowed - unless adding specializing annotations to them
5555
* Combine abstract interface implementations with interface specialization to model complex connectivity requirements

core-concepts/modules/ROOT/pages/typeql/query-variables-patterns.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ Such patterns are considered invalid and will throw disjoint variable usage erro
376376
See the xref:core-concepts::typeql/invalid-patterns.adoc[invalid patterns] page for more examples.
377377

378378
==== Valid variable scopes:
379-
Rephrasing the xref:reference::typeql/patterns/index.adoc#_scopes[unique scope principle], a variable is either:
379+
Rephrasing the xref:{page-version}@typeql-reference::patterns/index.adoc#_scopes[unique scope principle], a variable is either:
380380

381381
1. Internal to one branch of one disjunction.
382382
2. Internal to one negation.

core-concepts/modules/ROOT/pages/typeql/sql-vs-typeql.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ define
769769
| `LIMIT` | `limit` | Identical
770770
| `OFFSET` | `offset` | Identical
771771
| `DISTINCT` | `distinct` | Identical
772-
| `COUNT`/`SUM`/`AVG`/`etc.` | `reduce` with `count`/`sum`/`mean`/etc. | Similar, assigned to a variable|
772+
| `COUNT`/`SUM`/`AVG`/`etc.` | `reduce` with `count`/`sum`/`mean`/etc. | Similar, assigned to a variable
773773
| `UNION` | `or` patterns | Pattern disjunction
774774
| `EXISTS` | `not { not { ... } }` | Double negation pattern
775775
| `IN` | `or` with multiple `==` | Pattern disjunction

test/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
#

test/README.md renamed to test/code/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,20 @@ See examples in `./tests/` for how to write testable examples in `.adoc` files.
8383
### Directory run
8484

8585
```bash
86-
python -m test.main <lang> <directory>
86+
python -m test.code.main <lang> <directory>
8787
```
8888

8989
### Single file run
9090

9191
```bash
92-
python -m test.main <lang> <file>
92+
python -m test.code.main <lang> <file>
9393
```
9494

9595
## Development
9696

9797
### Type checking
9898

99-
Type check with `mypy test/main.py` (need to install `mypy`)
99+
Type check with `mypy test/code/main.py` (need to install `mypy`)
100100

101101
### Modules
102102

0 commit comments

Comments
 (0)