Skip to content

Commit ff64f07

Browse files
author
Patrick J. McNerthney
committed
More pytest cases and add CI report
1 parent 2f64b96 commit ff64f07

File tree

28 files changed

+746
-333
lines changed

28 files changed

+746
-333
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = tests/*

.github/workflows/ci.yaml

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
7-
- release-*
6+
- main
7+
- release-*
88
pull_request: {}
99
workflow_dispatch:
1010
inputs:
@@ -53,22 +53,38 @@ jobs:
5353
# - name: Lint
5454
# run: hatch run lint:check
5555

56-
unit-test:
56+
test:
5757
runs-on: ubuntu-24.04
5858
steps:
59-
- name: Checkout
60-
uses: actions/checkout@v4
61-
62-
- name: Setup Python
63-
uses: actions/setup-python@v5
64-
with:
65-
python-version: ${{ env.PYTHON_VERSION }}
66-
67-
- name: Setup Hatch
68-
run: pipx install hatch==1.14.1
69-
70-
- name: Run Unit Tests
71-
run: hatch run test:unit
59+
- name: Checkout
60+
uses: actions/checkout@v4
61+
62+
- name: Setup Python
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: ${{ env.PYTHON_VERSION }}
66+
67+
- name: Setup Hatch
68+
run: pipx install hatch==1.14.1
69+
70+
- name: Run Unit Tests
71+
run: hatch run test:ci
72+
73+
- name: Pytest coverage comment
74+
uses: MishaKav/pytest-coverage-comment@v1.1.54
75+
with:
76+
badge-title: Coverage
77+
title: Coverage Report
78+
pytest-xml-coverage-path: reports/pytest-coverage.xml
79+
junitxml-title: Unit Tests
80+
junitxml-path: reports/pytest-junit.xml
81+
#hide-badge: false
82+
#hide-report: false
83+
#create-new-comment: false
84+
#hide-comment: false
85+
#report-only-changed-files: false
86+
#remove-link-from-badge: false
87+
#unique-id-for-comment: python3.8
7288

7389
# We want to build most packages for the amd64 and arm64 architectures. To
7490
# speed this up we build single-platform packages in parallel. We then upload

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ coverage.xml
5353
.hypothesis/
5454
.pytest_cache/
5555
cover/
56+
reports/
5657

5758
# Translations
5859
*.mo

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ region = request.observed.composite.resource.spec.region
8585
region = request['observed']['composite']['resource']['spec']['region']
8686
```
8787
Getting values from free form map and list values will not throw
88-
errors for keys that do not exist, but will return an empty placeholder
88+
errors for keys that do not exist, but will return an unknown placeholder
8989
which evaluates as False. For example, the following will evaluate as False
9090
with a just created RunFunctionResponse message:
9191
```python
@@ -97,7 +97,7 @@ Note that maps or lists that do exist but do not have any members will evaluate
9797
as True, contrary to Python dicts and lists. Use the `len` function to test
9898
if the map or list exists and has members.
9999

100-
When setting fields, all empty intermediary placeholders will automatically
100+
When setting fields, all intermediary unknown placeholders will automatically
101101
be created. For example, this will create all items needed to set the
102102
region on the desired resource:
103103
```python
@@ -114,6 +114,7 @@ The following functions are provided to create Protobuf structures:
114114
| ----- | ----------- |
115115
| Map | Create a new Protobuf map |
116116
| List | Create a new Protobuf list |
117+
| Unknown | Create a new Protobuf unknown placeholder |
117118
| Yaml | Create a new Protobuf structure from a yaml string |
118119
| Json | Create a new Protobuf structure from a json string |
119120
| Base64Encode | Encode a string into base 64 |

examples/function-go-templating/conditions/README.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

examples/function-go-templating/context/README.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

examples/function-go-templating/extra-resources/composition.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ spec:
88
kind: XR
99
mode: Pipeline
1010
pipeline:
11-
1211
- step: render-templates
1312
functionRef:
1413
name: function-pythonic
@@ -18,7 +17,7 @@ spec:
1817
composite: |
1918
class Composite(BaseComposite):
2019
def compose(self):
21-
buckets = self.requireds.bucket('s3.aws.upbound.io/v1beta1', 'Bucket', f"my-awesome-{self.spec.environment}-bucket")
20+
buckets = self.requireds.bucket('s3.aws.upbound.io/v1beta1', 'Bucket', name=f"my-awesome-{self.spec.environment}-bucket")
2221
for ix, bucket in enumerate(buckets):
2322
r = self.resources[f"bucket-configmap-{ix}"]('kubernetes.crossplane.io/v1alpha1', 'Object')
2423
r.spec.providerConfigRef.name = 'kubernetes'

examples/function-go-templating/extra-resources/extraResources.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ spec:
1111
status:
1212
atProvider:
1313
id: random-bucket-id
14+

examples/function-go-templating/functions/getComposedResource/README.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

examples/function-go-templating/functions/getComposedResource/composition.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ spec:
2323
s = self.resources.flexServer(apiVersion, 'FlexibleServer')
2424
s.spec.providerConfigRef.name = 'my-provider-cfg'
2525
s.spec.forProvider.storageMb = 32768
26-
if s.status.atProvider.id:
27-
c = self.resources.flexServerConfig(apiVersion, 'FlexibleServerConfiguration')
28-
c.spec.providerConfigRef.name = 'my-provider-cfg'
29-
c.spec.forProvider.serverId = s.status.atProvider.id
26+
c = self.resources.flexServerConfig(apiVersion, 'FlexibleServerConfiguration')
27+
c.spec.providerConfigRef.name = 'my-provider-cfg'
28+
c.spec.forProvider.serverId = s.status.atProvider.id

0 commit comments

Comments
 (0)