github.com/jmrodri/operator-sdk@v0.5.0/pkg/scaffold/ansible/molecule_test_local_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 MoleculeTestLocalMoleculeFile = "molecule.yml" 24 25 type MoleculeTestLocalMolecule struct { 26 input.Input 27 } 28 29 // GetInput - gets the input 30 func (m *MoleculeTestLocalMolecule) GetInput() (input.Input, error) { 31 if m.Path == "" { 32 m.Path = filepath.Join(MoleculeTestLocalDir, MoleculeTestLocalMoleculeFile) 33 } 34 m.TemplateBody = moleculeTestLocalMoleculeAnsibleTmpl 35 36 return m.Input, nil 37 } 38 39 const moleculeTestLocalMoleculeAnsibleTmpl = `--- 40 dependency: 41 name: galaxy 42 driver: 43 name: docker 44 lint: 45 name: yamllint 46 enabled: False 47 platforms: 48 - name: kind-test-local 49 groups: 50 - k8s 51 image: bsycorp/kind:latest-1.12 52 privileged: True 53 exposed_ports: 54 - 8443/tcp 55 - 10080/tcp 56 published_ports: 57 - 0.0.0.0:${TEST_CLUSTER_PORT:-10443}:8443/tcp 58 pre_build_image: yes 59 volumes: 60 - ${MOLECULE_PROJECT_DIRECTORY}:/build:Z 61 provisioner: 62 name: ansible 63 log: True 64 lint: 65 name: ansible-lint 66 enabled: False 67 inventory: 68 group_vars: 69 all: 70 namespace: ${TEST_NAMESPACE:-osdk-test} 71 env: 72 K8S_AUTH_KUBECONFIG: /tmp/molecule/kind-test-local/kubeconfig 73 KUBECONFIG: /tmp/molecule/kind-test-local/kubeconfig 74 ANSIBLE_ROLES_PATH: ${MOLECULE_PROJECT_DIRECTORY}/roles 75 KIND_PORT: '${TEST_CLUSTER_PORT:-10443}' 76 scenario: 77 name: test-local 78 test_sequence: 79 - lint 80 - destroy 81 - dependency 82 - syntax 83 - create 84 - prepare 85 - converge 86 - side_effect 87 - verify 88 - destroy 89 verifier: 90 name: testinfra 91 lint: 92 name: flake8 93 `