github.com/jmrodri/operator-sdk@v0.5.0/pkg/scaffold/ansible/molecule_test_cluster_molecule.go (about)

     1  // Copyright 2018 The Operator-SDK Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package ansible
    16  
    17  import (
    18  	"path/filepath"
    19  
    20  	"github.com/operator-framework/operator-sdk/pkg/scaffold/input"
    21  )
    22  
    23  const MoleculeTestClusterMoleculeFile = "molecule.yml"
    24  
    25  type MoleculeTestClusterMolecule struct {
    26  	input.Input
    27  }
    28  
    29  // GetInput - gets the input
    30  func (m *MoleculeTestClusterMolecule) GetInput() (input.Input, error) {
    31  	if m.Path == "" {
    32  		m.Path = filepath.Join(MoleculeTestClusterDir, MoleculeTestClusterMoleculeFile)
    33  	}
    34  	m.TemplateBody = moleculeTestClusterMoleculeAnsibleTmpl
    35  
    36  	return m.Input, nil
    37  }
    38  
    39  const moleculeTestClusterMoleculeAnsibleTmpl = `---
    40  dependency:
    41    name: galaxy
    42  driver:
    43    name: delegated
    44    options:
    45      managed: False
    46      ansible_connection_options: {}
    47  lint:
    48    name: yamllint
    49    enabled: False
    50  platforms:
    51  - name: test-cluster
    52    groups:
    53    - k8s
    54  provisioner:
    55    name: ansible
    56    inventory:
    57      group_vars:
    58        all:
    59          namespace: ${TEST_NAMESPACE:-osdk-test}
    60    lint:
    61      name: ansible-lint
    62      enabled: False
    63    env:
    64      ANSIBLE_ROLES_PATH: ${MOLECULE_PROJECT_DIRECTORY}/roles
    65  scenario:
    66    name: test-cluster
    67    test_sequence:
    68      - lint
    69      - destroy
    70      - dependency
    71      - syntax
    72      - create
    73      - prepare
    74      - converge
    75      - side_effect
    76      - verify
    77      - destroy
    78  verifier:
    79    name: testinfra
    80    lint:
    81      name: flake8
    82  `