Skip to content

Support regex validation of property values #34

Closed
@cognifloyd

Description

@cognifloyd

Whenever detik is asked to verify a property value, it checks for equality with the expected value:

if [[ "$value" != "$expected_value" ]]; then

I would like to use a regex to verify that

  • a given string is in .spec.containers[*].command[*] or
  • that an annotation starts with or ends with a particular value.

The annotation is calculated in a helm chart, so I need to test and make sure that calculation is correct.

So, something like:

sensor_podname="stackstorm-ha-st2sensorcontainer-"  # the prefix for the pod name

verify "'.spec.containers[*].command[*]' is '.*,--sensor-ref=.*' for pods named '${sensor_podname}'"

try "at most 1 times every 5s to find 1 pod named '${sensor_podname}'" \
    "and verify that '.metadata.annotations.stackstorm/sensor-hash-ranges' is '0\.\.[0-9]+'"
try "at most 1 times every 5s to find 1 pod named '${sensor_podname}'" \
    "and verify that '.metadata.annotations.stackstorm/sensor-hash-ranges' is '[1-9][0-9]*\.\.4294967"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions