Skip to content

Enable FAST 00-cicd provider test #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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