Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): add python examples #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import models.io.upbound.dev.meta.v1alpha1 as metav1alpha1

_items = [
metav1alpha1.E2ETest{
metadata.name = "storagebucket"
metadata.name = "e2etest-storagebucket-kcl"
spec = {
crossplane.autoUpgrade.channel = "Rapid"
defaultConditions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import models.io.upbound.dev.meta.v1alpha1 as metav1alpha1

_items = [
metav1alpha1.E2ETest{
metadata.name = "xstoragebucket"
metadata.name = "e2etest-xstoragebucket-kcl"
spec = {
crossplane.autoUpgrade.channel = "Rapid"
defaultConditions = [
Expand Down
53 changes: 53 additions & 0 deletions tests/e2etest-xstoragebucket-python/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from .model.io.upbound.dev.meta.e2etest import v1alpha1 as e2etest
from .model.io.k8s.apimachinery.pkg.apis.meta import v1 as k8s
from .model.com.example.platform.xstoragebucket import v1alpha1 as xstoragebucket
from .model.io.upbound.aws.providerconfig import v1beta1 as providerconfig

bucket_manifest = xstoragebucket.XStorageBucket(
metadata=k8s.ObjectMeta(
name="uptest-bucket-xr",
),
spec=xstoragebucket.Spec(
parameters=xstoragebucket.Parameters(
acl="private",
region="eu-central-1",
versioning=True,
),
),
)

provider_config = providerconfig.ProviderConfig(
metadata=k8s.ObjectMeta(
name="default",
),
spec=providerconfig.Spec(
credentials=providerconfig.Credentials(
source="Upbound",
upbound=providerconfig.Upbound(
webIdentity=providerconfig.WebIdentity(
roleARN="arn:aws:iam::609897127049:role/example-project-aws-uptest",
),
),
),
),
)

test = e2etest.E2ETest(
metadata=k8s.ObjectMeta(
name="e2etest-xstoragebucket-python",
),
spec=e2etest.Spec(
crossplane=e2etest.Crossplane(
autoUpgrade=e2etest.AutoUpgrade(
channel=e2etest.Channel.Rapid,
),
),
defaultConditions=[
"Ready",
],
manifests=[bucket_manifest.model_dump()],
extraResources=[provider_config.model_dump()],
skipDelete=False,
timeoutSeconds=4500,
)
)
1 change: 1 addition & 0 deletions tests/e2etest-xstoragebucket-python/model
1 change: 1 addition & 0 deletions tests/e2etest-xstoragebucket-python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pydantic==2.10.6
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

import models.io.upbound.dev.meta.v1alpha1 as metav1alpha1

_items = [
metav1alpha1.CompositionTest{
metadata.name="test-xstoragebucket-default"
metadata.name="test-xstoragebucket-default-kcl"
spec= {
assertResources: []
compositionPath: "apis/xstoragebuckets/composition.yaml"
Expand Down
16 changes: 16 additions & 0 deletions tests/test-xstoragebucket-default-python/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from .model.io.upbound.dev.meta.compositiontest import v1alpha1 as compositiontest
from .model.io.k8s.apimachinery.pkg.apis.meta import v1 as k8s

test = compositiontest.CompositionTest(
metadata=k8s.ObjectMeta(
name="test-xstoragebucket-default-python",
),
spec = compositiontest.Spec(
assertResources=[],
compositionPath="apis/xstoragebuckets/composition.yaml",
xrPath="examples/xstoragebuckets/example.yaml",
xrdPath="apis/xstoragebuckets/definition.yaml",
timeoutSeconds=120,
validate=False,
)
)
1 change: 1 addition & 0 deletions tests/test-xstoragebucket-default-python/model
1 change: 1 addition & 0 deletions tests/test-xstoragebucket-default-python/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pydantic==2.10.6
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

import models.com.example.platform.v1alpha1 as platformv1alpha1
import models.io.upbound.aws.s3.v1beta1 as s3v1beta1
import models.io.upbound.dev.meta.v1alpha1 as metav1alpha1

_items = [
metav1alpha1.CompositionTest{
metadata.name="test-xstoragebucket"
metadata.name="test-xstoragebucket-kcl"
spec= {
assertResources: [
platformv1alpha1.XStorageBucket{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

import models.com.example.platform.v1alpha1 as platformv1alpha1
import models.io.upbound.aws.s3.v1beta1 as s3v1beta1
import models.io.upbound.dev.meta.v1alpha1 as metav1alpha1

_items = [
metav1alpha1.CompositionTest{
metadata.name="test-xstoragebucket"
metadata.name="test-xstoragebucket-versioning-kcl"
spec= {
assertResources: [
platformv1alpha1.XStorageBucket{
Expand Down