Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Dec 17, 2024
1 parent 7b37a80 commit e986980
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
10 changes: 8 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install black
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -Ur requirements.txt
- run: black --check .

flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install flake8
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -Ur requirements.txt
- run: flake8
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- run: |
pip install -r requirements.txt
Expand Down
25 changes: 17 additions & 8 deletions eve_elastic/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,10 +1067,13 @@ def reindex(self, resource, *, requests_per_second=1000): # noqa: F811

# create new index
new_index = generate_index_name(alias)
es.indices.create(index=new_index, body={
"settings": {"index": settings["settings"]} if settings else {},
"mappings": fix_mapping(mappings) if mappings else {},
})
es.indices.create(
index=new_index,
body={
"settings": {"index": settings["settings"]} if settings else {},
"mappings": fix_mapping(mappings) if mappings else {},
},
)

print("NEW INDEX", new_index)

Expand Down Expand Up @@ -1110,10 +1113,16 @@ def reindex(self, resource, *, requests_per_second=1000): # noqa: F811

# tmp index will be used for new items arriving during reindex
tmp_index = f"{old_index}-tmp"
es.indices.rollover(alias=alias, new_index=tmp_index, body={
"mappings": old_mappings[old_index]["mappings"] if old_mappings else mappings,
"settings": {"index": settings["settings"]} if settings else None,
})
es.indices.rollover(
alias=alias,
new_index=tmp_index,
body={
"mappings": (
old_mappings[old_index]["mappings"] if old_mappings else mappings
),
"settings": {"index": settings["settings"]} if settings else None,
},
)

print("TMP INDEX", tmp_index)

Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pytest
black==24.10.0
eve>1.1,<2.2
flake8==7.1.1
pytest==8.3.4
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
url="https://github.com/petrjasek/eve-elastic",
packages=["eve_elastic"],
test_suite="test.test_elastic",
tests_require=["nose", "flake8"],
install_requires=[
"arrow>=0.4.2",
"ciso8601>=1.0.2,<3",
Expand Down

0 comments on commit e986980

Please sign in to comment.