- name: list data-extraction pod
run: kubectl get pods -n traininghost
+
+ - name: run regression test
+ run: |
+ cd $GITHUB_WORKSPACE
+ pip install -r component-testing/tests/requirements.txt
+
+ kubectl port-forward svc/data-extraction -n traininghost 32001:32000 & PF_PID=$!
+ sleep 1
+ python3 -m pytest component-testing/tests --maxfail=1 --disable-warnings -q --html=pytest_report.html
+
+ # Stop port-forwarding
+ kill $PF_PID
+
+ - name: Upload Test Report
+ uses: actions/upload-artifact@v4
+ with:
+ name: pytest-report
+ path: pytest_report.html
vote:
--- /dev/null
+__pycache__/
+pytest_report.html
+assets
\ No newline at end of file
--- /dev/null
+# ==================================================================================
+#
+# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ==================================================================================
+
+
+# Since, Kind cluster runs in a docker container, therefore it is required to port-forward the svc to connect
+kubectl port-forward svc/data-extraction -n traininghost 32001:32000 & PF_PID=$!
+sleep 1
+python3 -m pytest ../tests/ --maxfail=1 --disable-warnings -q --html=pytest_report.html
+
+# Stop port-forwarding
+kill $PF_PID
\ No newline at end of file
--- /dev/null
+# ==================================================================================
+#
+# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# ==================================================================================
+requests
+pytest
+pytest-html
\ No newline at end of file
--- /dev/null
+import requests
+import pytest
+
+BASE_URL = "http://localhost:32001"
+
+def get_base_job_payload():
+ return {
+ "source": {
+ "InfluxSource": {
+ "query": "from(bucket:\"UEData\") |> range(start: 0, stop: now()) |> filter(fn: (r) => r._measurement == \"liveCell\") |> pivot(rowKey:[\"_time\"], columnKey: [\"_field\"], valueColumn: \"_value\")"
+ }
+ },
+ "transform": [
+ {
+ "operation": "SQLTransform",
+ "FeatureList": "pdcpBytesDl,pdcpBytesUl",
+ "SQLFilter": "nrCellIdentity = '\''c1/B13'\''"
+ }
+ ],
+ "sink": {
+ "CassandraSink": {
+ "CollectionName": "base1_52"
+ }
+ },
+ "trainingjob_id": "52",
+ "influxdb_info": {
+ "host": "mock-influxdb.traininghost",
+ "port": "8080",
+ "bucket": "UEData",
+ "token": "xxx",
+ "db_org": "primary",
+ "source_name": ""
+ }
+ }
+
+def submit_data_extraction_job(trainingjob_id):
+ '''
+ Helper function to submit data-extraction joband returns the task_id
+ '''
+ url = f"{BASE_URL}/feature-groups"
+ payload = get_base_job_payload()
+ payload["sink"]["CassandraSink"]["CollectionName"] = f"base1_{trainingjob_id}"
+ payload["trainingjob_id"] = trainingjob_id
+ r = requests.post(url=url, json=payload)
+ assert r.status_code == 200, f"Job Submission didn't returned 200 but returned {r.status_code}"
+ task_id = r.json().get("featurepath")
+ return task_id
+
+
+def test_data_extraction_job_submission_and_status_retrieval():
+ '''
+ The following test verifies that a data-extraction job can be successfully submitted and that its task status is retrievable via the corresponding API.
+ '''
+ # Submit the Data-extraction job
+ trainingjob_id = "100"
+ task_id = submit_data_extraction_job(trainingjob_id)
+
+ # Check job Status
+ task_status_url = f"{BASE_URL}/task-status/{task_id}"
+ r = requests.get(url=task_status_url)
+ response_dict = r.json()
+ assert r.status_code == 200, f"Task Retrieval didn't returned 200, but returned {r.status_code}"
+ assert response_dict.get("trainingjob_id") == trainingjob_id, "Trainingjob_id submitted and retrieved doesn't match"
\ No newline at end of file
commands =
#pip3 install -e {toxinidir}
- pytest --cov-report term-missing --cov-report xml --cov-report html --cov-fail-under=30 --junitxml=/tmp/tests.xml --cov={toxinidir}/dataextraction/
+ pytest --cov-report term-missing --cov-report xml --cov-report html --cov-fail-under=30 --junitxml=/tmp/tests.xml --cov={toxinidir}/dataextraction/ --ignore={toxinidir}/component-testing
coverage xml -i
# Docs