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

[Feature] support values/bindings in step name #2253

Open
1 task done
blezoray opened this issue Dec 27, 2024 · 0 comments
Open
1 task done

[Feature] support values/bindings in step name #2253

blezoray opened this issue Dec 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@blezoray
Copy link

blezoray commented Dec 27, 2024

Problem Statement

Hello,

I uses Chainsaw to test the Strimzi operator, which deploy Kafka clusters. I created this test:

# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
  name: kraft-upgrade
spec:
  bindings:
  - name: clusterName
    value: upgrade
  - name: authenticationType
    value: tls
  - name: superUser
    value: CN=adminuser
  steps:
  - name: Create Kafka Cluster version ($values.KafkaMinVersion)
    try:
    - apply:
        file: 00-cluster.yaml
    - assert:
        file: 00-assert.yaml
  - name: Create Topics
    try:
    - apply:
        file: ../steps/01-topics.yaml
    - assert:
        file: ../steps/01-assert.yaml
  - name: Create TLS Users
    try:
    - apply:
        file: ../steps/02-users.yaml
    - assert:
        file: ../steps/02-assert.yaml

# Upgrade
  - name: Patch Cluster to version ($values.KafkaMaxVersion)
    try:
    - apply:
        file: 03-patch-upgrade.yaml
    - assert:
        file: 03-assert.yaml

And my values.yaml

KafkaMinVersion: 3.8.0
KafkaMaxVersion: 3.9.0

KafkaMinMetadataVersion: 3.8-IV0
KafkaMaxMetadataVersion: 3.9-IV0

The output is :

Loading tests...
- kraft-upgrade (e2e/kraft-upgrade)
Loading values...
Running tests...
=== RUN   chainsaw
=== PAUSE chainsaw
=== CONT  chainsaw
=== RUN   chainsaw/kraft-upgrade
=== PAUSE chainsaw/kraft-upgrade
=== CONT  chainsaw/kraft-upgrade
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version ($values.KafkaMinVersion) | TRY       | BEGIN |
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version ($values.KafkaMinVersion) | APPLY     | RUN   | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/controller
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version ($values.KafkaMinVersion) | CREATE    | OK    | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/controller
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version ($values.KafkaMinVersion) | APPLY     | DONE  | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/controller
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version ($values.KafkaMinVersion) | APPLY     | RUN   | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/broker
...
    | 11:16:13 | kraft-upgrade | Patch Cluster to version ($values.KafkaMaxVersion)     | TRY       | BEGIN |
    | 11:16:13 | kraft-upgrade | Patch Cluster to version ($values.KafkaMaxVersion)     | APPLY     | RUN   | kafka.strimzi.io/v1beta2/Kafka @ mpms-auto-tests/upgrade
    | 11:16:13 | kraft-upgrade | Patch Cluster to version ($values.KafkaMaxVersion)     | PATCH     | OK    | kafka.strimzi.io/v1beta2/Kafka @ mpms-auto-tests/upgrade
    | 11:16:13 | kraft-upgrade | Patch Cluster to version ($values.KafkaMaxVersion)     | APPLY     | DONE  | kafka.strimzi.io/v1beta2/Kafka @ mpms-auto-tests/upgrade

I also tested a join function but I obtained the same result.

Solution Description

Is it possible to support values/binding substitution in step name/description in order to obtain something like:

Loading values...
Running tests...
=== RUN   chainsaw
=== PAUSE chainsaw
=== CONT  chainsaw
=== RUN   chainsaw/kraft-upgrade
=== PAUSE chainsaw/kraft-upgrade
=== CONT  chainsaw/kraft-upgrade
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version 3.8.0 | TRY       | BEGIN |
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version 3.8.0 | APPLY     | RUN   | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/controller
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version 3.8.0 | CREATE    | OK    | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/controller
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version 3.8.0 | APPLY     | DONE  | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/controller
    | 11:12:11 | kraft-upgrade | Create Kafka Cluster version 3.8.0 | APPLY     | RUN   | kafka.strimzi.io/v1beta2/KafkaNodePool @ mpms-auto-tests/broker
...
    | 11:16:13 | kraft-upgrade | Patch Cluster to version 3.9.0     | TRY       | BEGIN |
    | 11:16:13 | kraft-upgrade | Patch Cluster to version 3.9.0     | APPLY     | RUN   | kafka.strimzi.io/v1beta2/Kafka @ mpms-auto-tests/upgrade
    | 11:16:13 | kraft-upgrade | Patch Cluster to version 3.9.0     | PATCH     | OK    | kafka.strimzi.io/v1beta2/Kafka @ mpms-auto-tests/upgrade

Alternatives

No response

Additional Context

No response

Slack discussion

No response

Research

  • I have searched other issues in this repository and mine is not recorded.
@blezoray blezoray added the enhancement New feature or request label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant