Skip to content

Commit

Permalink
Enable FAST 00-cicd provider test (#865)
Browse files Browse the repository at this point in the history
* enable fast 00-cicd provider test

* don't overwrite version files in CI

* change provider pinning for all tests in CI file
  • Loading branch information
ludoo authored Oct 7, 2022
1 parent a0171b2 commit 78d1a09
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ jobs:
terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false

# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions
run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
find -name versions.tf -exec cp default-versions.tf {} \;
for f in $(find . -name versions.tf); do
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests on documentation examples
id: pytest
Expand Down Expand Up @@ -87,10 +89,12 @@ jobs:
terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false

# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions
run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
find -name versions.tf -exec cp default-versions.tf {} \;
for f in $(find . -name versions.tf); do
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests environments
id: pytest
Expand Down Expand Up @@ -120,10 +124,12 @@ jobs:
terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false

# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions
run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
find -name versions.tf -exec cp default-versions.tf {} \;
for f in $(find . -name versions.tf); do
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests modules
id: pytest
Expand Down Expand Up @@ -153,10 +159,12 @@ jobs:
terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false

# avoid conflicts with user-installed providers on local machines
- name: Pin provider versions
run: |
sed -i 's/>=\(.*# tftest\)/=\1/g' default-versions.tf
find -name versions.tf -exec cp default-versions.tf {} \;
for f in $(find . -name versions.tf); do
sed -i 's/>=\(.*# tftest\)/=\1/g' $f;
done
- name: Run tests on FAST stages
id: pytest
Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ def run_apply(fixture_path=None, **tf_vars):
return apply, output

return run_apply


@pytest.fixture
def basedir():
return BASEDIR
17 changes: 9 additions & 8 deletions tests/fast/stages/s00_cicd/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import pathlib
import os
'''
github = {
source = "integrations/github"
Expand All @@ -24,10 +24,11 @@
}
'''

# def test_providers():
# "Test providers file."
# p = pathlib.Path(__file__).parents[4]
# with (p / 'fast/stages/00-cicd/versions.tf').open() as f:
# data = f.read()
# assert 'integrations/github' in data
# assert 'gitlabhq/gitlab' in data

def test_providers(basedir):
"Test providers file."
p = os.path.join(basedir, 'fast/stages/00-cicd/versions.tf')
with open(p) as f:
data = f.read()
assert 'integrations/github' in data
assert 'gitlabhq/gitlab' in data

0 comments on commit 78d1a09

Please sign in to comment.