@container-mount
Feature: container-instance --mount flag
  Verifies that resource add container-instance accepts --mount flags
  for both resource-reference and host-path mount specifications.

  Scenario: Single resource-reference mount for mount_flag
    Given a resource registry service for mount_flag
    When I add a container-instance with mount "local/api-repo:/workspace" for mount_flag
    Then the mount_flag resource should have 1 mount
    And mount_flag mount 0 source should be "local/api-repo"
    And mount_flag mount 0 target should be "/workspace"
    And mount_flag mount 0 mode should be "rw"
    And mount_flag mount 0 type should be "resource"

  Scenario: Single host-path mount with ro mode for mount_flag
    Given a resource registry service for mount_flag
    When I add a container-instance with mount "/var/config:/config:ro" for mount_flag
    Then the mount_flag resource should have 1 mount
    And mount_flag mount 0 source should be "/var/config"
    And mount_flag mount 0 target should be "/config"
    And mount_flag mount 0 mode should be "ro"
    And mount_flag mount 0 type should be "bind"

  Scenario: Dual mount per WF17 spec for mount_flag
    Given a resource registry service for mount_flag
    When I add a container-instance with mounts for mount_flag:
      | mount_spec                        |
      | local/api-repo:/workspace         |
      | /var/shared/config:/config:ro     |
    Then the mount_flag resource should have 2 mounts
    And mount_flag mount 0 source should be "local/api-repo"
    And mount_flag mount 0 target should be "/workspace"
    And mount_flag mount 0 mode should be "rw"
    And mount_flag mount 1 source should be "/var/shared/config"
    And mount_flag mount 1 target should be "/config"
    And mount_flag mount 1 mode should be "ro"

  Scenario: Mount info persisted and retrievable for mount_flag
    Given a resource registry service for mount_flag
    When I add a container-instance with mount "local/repo:/app" for mount_flag
    And I show the mount_flag resource
    Then the mount_flag show output should contain "local/repo"
    And the mount_flag show output should contain "/app"

  Scenario: Absolute host path 2-part mount is bind type for mount_flag
    Given a resource registry service for mount_flag
    When I add a container-instance with mount "/data:/app" for mount_flag
    Then the mount_flag resource should have 1 mount
    And mount_flag mount 0 source should be "/data"
    And mount_flag mount 0 target should be "/app"
    And mount_flag mount 0 type should be "bind"
    And mount_flag mount 0 mode should be "rw"

  Scenario: Mount rejected on non-container type for mount_flag
    When I parse mount spec "local/repo:/app" for mount_flag on type "git-checkout"
    Then mount_flag type validation should fail

  Scenario: Invalid mount mode rejected for mount_flag
    When I parse mount spec "/src:/dst:rx" for mount_flag
    Then mount_flag parse should fail with "Invalid mount mode"

  Scenario: Invalid mount format rejected for mount_flag
    When I parse mount spec "a:b:c:d" for mount_flag
    Then mount_flag parse should fail with "Invalid mount spec"
