-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy_test_documents.py
executable file
·42 lines (35 loc) · 1.07 KB
/
copy_test_documents.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
"""
This script copies test documents from the pipeline repo into this repo.
For now, it's using a local clone, but eventually this script will be
extended to fetch from a remote repo on GitHub.
"""
import glob
import os
import shutil
import sys
try:
PIPELINE_ROOT = sys.argv[1]
except IndexError:
sys.exit(f"Usage: {__file__} <PATH_TO_PIPELINE_REPO>")
prefixes = [
"common/internal_model/src/test/resources",
"pipeline/ingestor/test_documents",
]
for prefix in prefixes:
for path in glob.glob(f"{PIPELINE_ROOT}/{prefix}/*.json"):
shutil.copyfile(
path,
os.path.join(
"common/search/src/test/resources/test_documents",
os.path.basename(path),
),
)
os.rename(
"./common/search/src/test/resources/test_documents/WorksIndexConfig.json",
"./common/search/src/test/resources/WorksIndexConfig.json",
)
os.rename(
"./common/search/src/test/resources/test_documents/ImagesIndexConfig.json",
"./common/search/src/test/resources/ImagesIndexConfig.json",
)