fix tests

pull/30/head
deadc0de6 1 year ago
parent d294aa59e1
commit e39088f6cb

@ -17,6 +17,7 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r tests-requirements.txt pip install -r tests-requirements.txt
pip install -r requirements.txt pip install -r requirements.txt
sudo apt-get install shellcheck
- name: Run tests - name: Run tests
run: | run: |
./tests.sh ./tests.sh

@ -322,11 +322,11 @@ class Noder:
""" """
if not node: if not node:
return return
if node.type == node.TYPE_TOP: if node.type == nodes.TYPE_TOP:
return return
out = [] out = []
if node.type == node.TYPE_STORAGE: if node.type == nodes.TYPE_STORAGE:
# handle storage # handle storage
out.append(node.name) # name out.append(node.name) # name
out.append(node.type) # type out.append(node.type) # type
@ -357,7 +357,7 @@ class Noder:
out.append(epoch_to_str(node.maccess)) # maccess out.append(epoch_to_str(node.maccess)) # maccess
else: else:
out.append('') # fake maccess out.append('') # fake maccess
if node.md5: if self._has_attr(node, 'md5'):
out.append(node.md5) # md5 out.append(node.md5) # md5
else: else:
out.append('') # fake md5 out.append('') # fake md5

@ -0,0 +1,5 @@
"github","storage","","2380","2023-03-08 20:58:18","","","2","23343173632","245107195904",""
"workflows","dir","github/workflows","1190","2023-03-08 20:58:18","2023-03-02 10:15:30","","2","","",""
"pypi-release.yml","file","github/workflows/pypi-release.yml","691","2023-03-08 20:58:18","2022-10-19 21:00:37","57699a7a6a03e20e864f220e19f8e197","","","",""
"testing.yml","file","github/workflows/testing.yml","595","2023-03-08 20:58:18","2023-03-02 10:15:30","f4f4bc5acb9deae488b55f0c9c507120","","","",""
"FUNDING.yml","file","github/FUNDING.yml","17","2023-03-08 20:58:18","2022-10-19 21:00:37","0c6407a84d412c514007313fb3bca4de","","","",""

@ -5,7 +5,7 @@
"children": [ "children": [
{ {
"maccess": 1666206037.0786593, "maccess": 1666206037.0786593,
"md5": null, "md5": "0c6407a84d412c514007313fb3bca4de",
"name": "FUNDING.yml", "name": "FUNDING.yml",
"relpath": "/FUNDING.yml", "relpath": "/FUNDING.yml",
"size": 17, "size": 17,
@ -15,7 +15,7 @@
"children": [ "children": [
{ {
"maccess": 1666206037.078865, "maccess": 1666206037.078865,
"md5": null, "md5": "57699a7a6a03e20e864f220e19f8e197",
"name": "pypi-release.yml", "name": "pypi-release.yml",
"relpath": "workflows/pypi-release.yml", "relpath": "workflows/pypi-release.yml",
"size": 691, "size": 691,
@ -23,7 +23,7 @@
}, },
{ {
"maccess": 1677748530.6920426, "maccess": 1677748530.6920426,
"md5": null, "md5": "f4f4bc5acb9deae488b55f0c9c507120",
"name": "testing.yml", "name": "testing.yml",
"relpath": "workflows/testing.yml", "relpath": "workflows/testing.yml",
"size": 595, "size": 595,
@ -38,18 +38,18 @@
"type": "dir" "type": "dir"
} }
], ],
"free": 23459602432, "free": 23343173632,
"name": "github", "name": "github",
"size": 2380, "size": 2380,
"total": 245107195904, "total": 245107195904,
"ts": 1678214993, "ts": 1678305498,
"type": "storage" "type": "storage"
}, },
{ {
"attr": { "attr": {
"access": 1678214993, "access": 1678305498,
"access_version": "0.8.7", "access_version": "0.8.7",
"created": 1678214993, "created": 1678305498,
"created_version": "0.8.7" "created_version": "0.8.7"
}, },
"name": "meta", "name": "meta",

@ -0,0 +1,7 @@
top
└── storage: github
nbfiles:2 | totsize:2380 | free:9.5% | du:221764022272/245107195904 | date:2023-03-08 20:58:18
├── workflows [nbfiles:2, totsize:1190]
│ ├── pypi-release.yml [size:691, md5:57699a7a6a03e20e864f220e19f8e197]
│ └── testing.yml [size:595, md5:f4f4bc5acb9deae488b55f0c9c507120]
└── FUNDING.yml [size:17, md5:0c6407a84d412c514007313fb3bca4de]

@ -49,11 +49,18 @@ clear_on_exit "${tmpd}"
catalog="${tmpd}/catalog" catalog="${tmpd}/catalog"
# index # index
${bin} -B index --catalog="${catalog}" github .github ${bin} -B index -c --catalog="${catalog}" github .github
# diff
cat "${catalog}" cat "${catalog}"
diff "${cur}/assets/github.catalog.json" "${catalog}"
# make sure we still get the same output in native format
native="${tmpd}/native.txt"
${bin} -B ls -r -s --format=native --catalog="${catalog}" > "${native}"
diff -I '^.*| totsize.*$' "${cur}/assets/github.catalog.native.txt" "${native}"
# make sure we still get the same output in csv
csv="${tmpd}/csv.txt"
${bin} -B ls -r -s --format=csv --catalog="${catalog}" > "${csv}"
diff -I '^.*| totsize.*$' "${cur}/assets/github.catalog.csv.txt" "${csv}"
# the end # the end
echo "test \"$(basename "$0")\" success" echo "test \"$(basename "$0")\" success"

Loading…
Cancel
Save