Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 44 additions & 22 deletions .github/workflows/integration-tests-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
python -m pip install --upgrade pip
pip install ".[dev]"

- name: Run integration tests HTTP
- name: "Compose: Run integration tests HTTP"
env:
SERVICE_ID: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}
SERVICE_SECRET: ${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}
Expand All @@ -77,9 +77,9 @@ jobs:
ACCOUNT_NAME: ""
CORE_URL: ${{ steps.setup-core.outputs.service_url }}
run: |
pytest -o log_cli=true -o log_cli_level=WARNING tests/integration -k "core" --alluredir=allure-results/
pytest -o log_cli=true -o log_cli_level=WARNING tests/integration -k "core" --run-compose --alluredir=allure-results/

- name: Run integration tests HTTPS
- name: "Compose: Run integration tests HTTPS"
env:
SERVICE_ID: ${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}
SERVICE_SECRET: ${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}
Expand All @@ -90,7 +90,14 @@ jobs:
ACCOUNT_NAME: ""
CORE_URL: ${{ steps.setup-core.outputs.service_https_url }}
run: |
pytest -o log_cli=true -o log_cli_level=WARNING tests/integration -k "core" --alluredir=allure-results-https/
pytest -o log_cli=true -o log_cli_level=WARNING tests/integration -k "core" --run-compose --alluredir=allure-results-https/

- name: "Kind: Run integration tests HTTP"
env:
HELM_CHART_VERSION: "0.3.0"
CORE_IMAGE_TAG: ${{ inputs.tag_version || vars.DEFAULT_CORE_IMAGE_TAG }}
run: |
pytest -o log_cli=true -o log_cli_level=WARNING tests/integration -k "core" --run-kind --alluredir=allure-results-kind-http/

# Need to pull the pages branch in order to fetch the previous runs
- name: Get Allure history
Expand All @@ -101,24 +108,39 @@ jobs:
ref: gh-pages
path: gh-pages

- name: Allure Report
uses: firebolt-db/action-allure-report@781b4529b67b4f393c63d7dc1e098cb558e1ab16 # v1.4.1
- name: Install Allure CLI
id: install-allure
if: always()
continue-on-error: true
with:
github-key: ${{ secrets.GITHUB_TOKEN }}
test-type: core
allure-dir: allure-results
pages-branch: gh-pages
repository-name: python-sdk
env:
ALLURE_VERSION: "2.38.1"
run: |
npm install -g allure-commandline

- name: Allure Report HTTPS
uses: firebolt-db/action-allure-report@781b4529b67b4f393c63d7dc1e098cb558e1ab16 # v1.4.1
if: always()
continue-on-error: true
- name: Generate All Reports Locally
id: generate-reports
if: always() && steps.install-allure.outcome == 'success'
run: |
REPORT_BASE="allure-final/allure/python-sdk_${{ github.sha }}"
allure generate allure-results -o "${REPORT_BASE}_core"
allure generate allure-results-https -o "${REPORT_BASE}_core_https"
allure generate allure-results-kind-http -o "${REPORT_BASE}_core_kind"

- name: Deploy all reports to GitHub Pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
id: deploy-reports
if: always() && steps.generate-reports.outcome == 'success'
with:
github-key: ${{ secrets.GITHUB_TOKEN }}
test-type: core_https
allure-dir: allure-results-https
pages-branch: gh-pages
repository-name: python-sdk
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./allure-final
keep_files: true

- name: Set Job Summary
if: always() && steps.deploy-reports.outcome == 'success'
env:
BASE_URL: "https://python.docs.firebolt.io/allure/python-sdk_${{ github.sha }}"
run: |
echo "### Test Reports" >> $GITHUB_STEP_SUMMARY
echo "* [Core HTTP Report](${BASE_URL}_core)" >> $GITHUB_STEP_SUMMARY
echo "* [HTTPS Report](${BASE_URL}_core_https)" >> $GITHUB_STEP_SUMMARY
echo "* [Kind HTTP Report](${BASE_URL}_core_kind)" >> $GITHUB_STEP_SUMMARY
44 changes: 33 additions & 11 deletions CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Optionally setup PyCharm linting shortcut:
Name: lint
Description: Format the current file
Program: $PyInterpreterDirectory$/pre-commit
Arguments: run --files=$FilePath$Working
Arguments: run --files=$FilePath$Working
Working Directory: $ProjectFileDir$
```
2. Preferences -> Keymap -> External Tools -> lint,
2. Preferences -> Keymap -> External Tools -> lint,
Assign the keyboard shortcut `Option-cmd-l`

### Before Committing
Expand All @@ -28,8 +28,8 @@ Working Directory: $ProjectFileDir$
2. run `mypy src` to check for type errors
3. run `pytest tests/unit` to run unit tests

Note: while there is a `mypy` hook for pre-commit,
I found it too buggy to be worthwhile, so I just run mypy manually.
Note: while there is a `mypy` hook for pre-commit,
I found it too buggy to be worthwhile, so I just run mypy manually.

### PR procedures

Expand All @@ -44,13 +44,35 @@ I found it too buggy to be worthwhile, so I just run mypy manually.
4. If the integration tests pass and the change looks good to the maintainer they approve it.
5. Merge into the main branch. Only the maintainers have the ability to merge a PR. They will do so at the earliest convenience, with regards to the impact of the change as well as the release planning.

### Integration Tests
The integration test suite runs against Firebolt SaaS v1, Firebolt SaaS v2 and Firebolt Core. The SaaS test suites only run as part of the CI. Locally you can run the Firebolt Core test suite.

#### Run the tests locally

**Run on Kind:**
You must have [kind](https://kind.sigs.k8s.io/) installed. The test driver will create a kind cluster and install the Firebolt Core Helm chart.

```shell
pytest -k "core" --run-kind tests/integration
```

**Run on Docker Compose:**
```shell
pytest -k "core" --run-compose tests/integration
```

### Include a test in the core suite
Not all integration tests are supported by Firebolt Core.

The tests that are supported, use `@fixture(params=["core"])` on the fixture. Other ways are to use a `core` mark or add `core` in the name of the test. For more details on how tests are selected with the `pytest -k` flag, please check the pytest documentation.

### Docstrings

Use the Google format for docstrings. Do not include types or an indication
of "optional" in docstrings. Those should be captured in the function signature
Use the Google format for docstrings. Do not include types or an indication
of "optional" in docstrings. Those should be captured in the function signature
as type annotations; no need to repeat them in the docstring.

Public methods and functions should have docstrings.
Public methods and functions should have docstrings.
One-liners are fine for simple methods and functions.

For PyCharm Users:
Expand All @@ -73,20 +95,20 @@ In general, organize class internals in this order:
* alternative constructors first
* other classmethods next
4. properties (`@property`)
5. remaining methods
5. remaining methods
* put more important / broadly applicable functions first
* group related functions together to minimize scrolling

Read more about this philosophy
Read more about this philosophy
[here](https://softwareengineering.stackexchange.com/a/199317).

### Huge classes

If classes start to approach 1k lines, consider breaking them into parts,
If classes start to approach 1k lines, consider breaking them into parts,
possibly like [this](https://stackoverflow.com/a/47562412).

### Versioning

Consider adopting:
Consider adopting:
* https://packboard.atlassian.net/wiki/x/AYC6aQ
* https://python-semantic-release.readthedocs.io/en/latest/
7 changes: 7 additions & 0 deletions kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
Loading
Loading