Skip to content

Commit

Permalink
Added consistency tests, bypassed all other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwest77a committed Oct 29, 2024
1 parent d1d09f9 commit 80780f3
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ceda_elasticsearch_tools/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

def pytest_collection_modifyitems(items):

CLASS_ORDER = [
"TestConsistency",
# "TestCedaDirsUpdaterDeposit",
# "TestCedaDirsUpdaterMoles",
# "TestCedaFbiUpdaterDeposit",
# "TestIndexUpdaterBase",
# "TestClusterHealth",
# "TestMainAliases",
# "TestEOQueries",
# "TestEFFQueries",
# "TestOpensearchQueries",
# "TestIndexMapping",
# "SpotMappingTestCase",
# "CedaEOQueries",
# "IndexMappings",
]

sorted_items = items.copy()
# read the class names from default items
class_mapping = {item: item.cls.__name__ for item in items}


# Iteratively move tests of each class to the end of the test queue
for class_ in CLASS_ORDER:
sorted_items = [it for it in sorted_items if class_mapping[it] != class_] + [
it for it in sorted_items if class_mapping[it] == class_
]


items[:] = sorted_items
92 changes: 92 additions & 0 deletions ceda_elasticsearch_tools/tests/test_consistency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@

class TestConsistency:

def test_index_tools(self):
from ceda_elasticsearch_tools import IndexUpdaterBase, BulkClient, __version__
from ceda_elasticsearch_tools.index_tools import (
CedaDirs,
CedaEo,
CedaFbi
)

assert 1==1, "Importing index tools successful."

def test_elasticsearch(self):
from ceda_elasticsearch_tools import CEDAElasticsearchClient
from ceda_elasticsearch_tools.elasticsearch.ceda_elasticsearch_client import CA_ROOT

assert 1==1, "Importing elasticsearch successful."

def test_core(self):
from ceda_elasticsearch_tools.core.log_reader import (
SpotMapping,
MD5LogFile,
DepositLog,
)

from ceda_elasticsearch_tools.core.updater import (
ElasticsearchQuery,
IndexFilter,
ElasticsearchUpdater
)

from ceda_elasticsearch_tools.core.utils import (
get_number_of_submitted_lotus_tasks,
percent,
get_latest_log,
list2file_newlines,
ProgressBar
)

assert 1==1, "Importing core successful."

def test_cmdline(self):

from ceda_elasticsearch_tools.cmdline.ceda_eo.coverage_test import main
from ceda_elasticsearch_tools.cmdline.secondary_scripts.md5 import (
logger_setup,
file_md5,
main
)
from ceda_elasticsearch_tools.cmdline.secondary_scripts.nla_sync_lotus_task import (
main,
NLASync
)

from ceda_elasticsearch_tools.cmdline.secondary_scripts.spot_checker import (
es_connection,
main,
make_query,
process_list,
get_args,
dir_exists
)

from ceda_elasticsearch_tools.cmdline.fbs_missing_files import (
submit_jobs_to_lotus,
generate_summary,
create_missing_list,
nolotus,
main,
)

from ceda_elasticsearch_tools.cmdline.nla_sync_es import (
chunk_dict,
chunks,
create_output_dir,
download_data_from_nla,
main,
loading
)

from ceda_elasticsearch_tools.cmdline.update_md5 import (
logger_setup,
update_from_logs,
extract_id,
write_page_to_file,
download_files_missing_md5,
calculate_md5s,
main
)

assert 1==1, "Importing cmdline successful."

0 comments on commit 80780f3

Please sign in to comment.