Skip to content

Commit 9488e73

Browse files
authored
test: Roll back boto3 for report upload (#502)
* gha test 1 * roll back boto3 version for test upload * roll back boto3 version for test upload * address codeQL warnings * address codeQL warnings * make format
1 parent 0e1f0a3 commit 9488e73

File tree

3 files changed

+59
-16
lines changed

3 files changed

+59
-16
lines changed

.github/workflows/e2e-test.yml

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,14 @@ jobs:
7676
env:
7777
LINODE_TOKEN: ${{ env.LINODE_TOKEN }}
7878

79-
- name: Upload test results
79+
- name: Upload Test Report as Artifact
8080
if: always()
81-
run: |
82-
filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
83-
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/add_gha_info_to_xml.py \
84-
--branch_name "${GITHUB_REF#refs/*/}" \
85-
--gha_run_id "$GITHUB_RUN_ID" \
86-
--gha_run_number "$GITHUB_RUN_NUMBER" \
87-
--xmlfile "${filename}"
88-
sync
89-
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/xml_to_obj.py "${filename}"
90-
env:
91-
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
92-
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: test-report-file
84+
if-no-files-found: ignore
85+
path: '*.xml'
86+
retention-days: 1
9387

9488
apply-calico-rules:
9589
runs-on: ubuntu-latest
@@ -156,6 +150,50 @@ jobs:
156150
env:
157151
LINODE_CLI_TOKEN: ${{ env.LINODE_TOKEN }}
158152

153+
process-upload-report:
154+
runs-on: ubuntu-latest
155+
needs: [integration-tests]
156+
if: always() && github.repository == 'linode/linode_api4-python' # Run even if integration tests fail and only on main repository
157+
158+
steps:
159+
- name: Checkout code
160+
uses: actions/checkout@v4
161+
with:
162+
fetch-depth: 0
163+
submodules: 'recursive'
164+
165+
- name: Download test report
166+
uses: actions/download-artifact@v4
167+
with:
168+
name: test-report-file
169+
170+
- name: Set up Python
171+
uses: actions/setup-python@v5
172+
with:
173+
python-version: '3.x'
174+
175+
- name: Install Python dependencies
176+
run: pip3 install requests wheel boto3==1.35.99
177+
178+
- name: Set release version env
179+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
180+
181+
182+
- name: Add variables and upload test results
183+
if: always()
184+
run: |
185+
filename=$(ls | grep -E '^[0-9]{12}_sdk_test_report\.xml$')
186+
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/add_gha_info_to_xml.py \
187+
--branch_name "${GITHUB_REF#refs/*/}" \
188+
--gha_run_id "$GITHUB_RUN_ID" \
189+
--gha_run_number "$GITHUB_RUN_NUMBER" \
190+
--xmlfile "${filename}"
191+
sync
192+
python3 e2e_scripts/tod_scripts/xml_to_obj_storage/scripts/xml_to_obj.py "${filename}"
193+
env:
194+
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
195+
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
196+
159197
notify-slack:
160198
runs-on: ubuntu-latest
161199
needs: [integration-tests]

test/unit/objects/database_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
from test.unit.base import ClientBaseCase
23

34
from linode_api4 import PostgreSQLDatabase
@@ -106,6 +107,8 @@ def test_create(self):
106107
Test that MySQL databases can be created
107108
"""
108109

110+
logger = logging.getLogger(__name__)
111+
109112
with self.mock_post("/databases/mysql/instances") as m:
110113
# We don't care about errors here; we just want to
111114
# validate the request.
@@ -117,8 +120,10 @@ def test_create(self):
117120
"g6-standard-1",
118121
cluster_size=3,
119122
)
120-
except Exception:
121-
pass
123+
except Exception as e:
124+
logger.warning(
125+
"An error occurred while validating the request: %s", e
126+
)
122127

123128
self.assertEqual(m.method, "post")
124129
self.assertEqual(m.call_url, "/databases/mysql/instances")

test/unit/objects/vpc_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_list_ips(self):
138138

139139
ip = result[0]
140140
assert ip.address == "10.0.0.2"
141-
assert ip.address_range == None
141+
assert ip.address_range is None
142142
assert ip.vpc_id == 123
143143
assert ip.subnet_id == 456
144144
assert ip.region == "us-mia"

0 commit comments

Comments
 (0)