Skip to content

Commit

Permalink
Merge branch 'GoogleCloudPlatform:main' into gcip_config
Browse files Browse the repository at this point in the history
  • Loading branch information
mraouffouad authored Jul 10, 2023
2 parents f8ac631 + 93a3c7f commit bcb8009
Show file tree
Hide file tree
Showing 782 changed files with 13,256 additions and 10,819 deletions.
5 changes: 0 additions & 5 deletions .ci/containers/downstream-builder/generate_downstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ else
fi
pushd ../
make tpgtools OUTPUT_PATH=$LOCAL_PATH VERSION=$VERSION
pushd ./tools/breaking-change-detector
set +e
go run . -docs -providerFolder="${LOCAL_PATH}/.github/"
set -e
popd
popd
fi
fi
Expand Down
39 changes: 37 additions & 2 deletions .ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ mkdir testlog
mkdir testlog/replaying
mkdir testlog/recording
mkdir testlog/recording_build
mkdir testlog/replaying_after_recording
mkdir testlog/replaying_build_after_recording

export GOOGLE_REGION=us-central1
export GOOGLE_ZONE=us-central1-a
Expand Down Expand Up @@ -217,13 +219,48 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then

RECORDING_FAILED_TESTS=$(grep "^--- FAIL: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[Error message](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/build-log/recording_build/"$3"_recording_test.log)] [[Debug log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}')
RECORDING_PASSED_TESTS=$(grep "^--- PASS: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[Debug log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}')
RECORDING_PASSED_TEST_LIST=$(grep "^--- PASS: TestAcc" recording_test.log | awk '{print $3}')

comment=""
RECORDING_PASSED_TESTS_COUNT=0
RECORDING_FAILED_TESTS_COUNT=0
if [[ -n $RECORDING_PASSED_TESTS ]]; then
comment+="Tests passed during RECORDING mode:${NEWLINE} $RECORDING_PASSED_TESTS ${NEWLINE}${NEWLINE}"
RECORDING_PASSED_TESTS_COUNT=$(echo "$RECORDING_PASSED_TESTS" | wc -l)
comment+="##### Rerun these tests in REPLAYING mode to catch issues ${NEWLINE}${NEWLINE}"

# Rerun passed tests in REPLAYING mode 3 times to catch issues
export VCR_MODE=REPLAYING
count=3
parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/replaying_after_recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test $GOOGLE_TEST_DIRECTORY -parallel 1 -count=$count -v -run="{}$" -timeout 120m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">" testlog/replaying_build_after_recording/{}_replaying_test.log ::: $RECORDING_PASSED_TEST_LIST

test_exit_code=$?

# Concatenate recording build logs to one file
for test in $RECORDING_PASSED_TEST_LIST
do
cat testlog/replaying_build_after_recording/${test}_replaying_test.log >> replaying_build_after_recording.log
done

# store replaying individual build logs
gsutil -h "Content-Type:text/plain" -m -q cp testlog/replaying_build_after_recording/* gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_build_after_recording/

# store replaying test logs
gsutil -h "Content-Type:text/plain" -m -q cp testlog/replaying_after_recording/* gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/replaying_after_recording/

REPLAYING_FAILED_TESTS=$(grep "^--- FAIL: TestAcc" replaying_build_after_recording.log | sort -u -t' ' -k3,3 | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[Error message](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/build-log/replaying_build_after_recording/"$3"_replaying_test.log)] [[Debug log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/replaying_after_recording/"$3".log)]"}')
if [[ -n $REPLAYING_FAILED_TESTS ]]; then
comment+="Tests failed when rerunning REPLAYING mode:${NEWLINE} $REPLAYING_FAILED_TESTS ${NEWLINE}${NEWLINE}"
comment+="Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.${NEWLINE}${NEWLINE}"
comment+="Please fix these to complete your PR. If you do not know how VCR tests work, please work with the code reviewer to figure out the reason why the tests failed and fix the tests.${NEWLINE}"
else
comment+="All tests passed after rerunning REPLAYING mode.${NEWLINE}"
fi
comment+="${NEWLINE}---${NEWLINE}"

# Clear replaying-log folder
rm testlog/replaying_after_recording/*
rm testlog/replaying_build_after_recording/*
fi

if [[ -n $RECORDING_FAILED_TESTS ]]; then
Expand All @@ -239,8 +276,6 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then
elif [[ $test_exit_code -ne 0 ]]; then
# check for any uncaught errors in RECORDING mode
comment+="Errors occurred during RECORDING mode. Please fix them to complete your PR${NEWLINE}"
else
comment+="All tests passed${NEWLINE}"
fi
fi

Expand Down
3 changes: 0 additions & 3 deletions .ci/containers/magic-modules-dev/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion .ci/containers/membership-checker/membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
var (
// This is for the random-assignee rotation.
reviewerRotation = []string{
"megan07",
"slevenick",
"c2thorn",
"rileykarson",
Expand Down
1 change: 1 addition & 0 deletions .ci/infra/terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ After applying this configuration:
- Add Group Admin role to new service account in the Google Workspace Admin Console: https://admin.google.com/ac/roles
- Add a new test user in the Google Workspace Admin Console: https://admin.google.com/ac/users
- Create a `support@` group in the Google Workspace Admin Console, add new service account as a member, and make it an owner
- Enroll in Cloud Armor Managed Protection Plus tier

Quotas that will need to be adjusted to support all tests:
- Project quota for the new service account
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # v2.6.0
with:
hugo-version: 'latest'
hugo-version: '0.115.0'
extended: true

- name: Build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pre-build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
run: |
cd repo
git config user.name "modular-magician"
git config user.email "magic-modules@google.com"
git merge --no-ff origin/main
yamlfiles=$(git diff --name-only origin/main -- mmv1/products)
if [ ! -z "$yamlfiles" ]; then
Expand Down
11 changes: 10 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ To view locally:


If you are having deployment issues, try to reset your hugo module cache.
* `hugo mod clean`
* `hugo mod clean`

To upgrade the theme version:
1. find the version you want at https://github.com/alex-shpak/hugo-book/commits/master
2. Run the following
```bash
go get github.com/alex-shpak/hugo-book@{{commit_hash}}
## example
## go get github.com/alex-shpak/hugo-book@d86d5e70c7c0d787675b13d9aee749c1a8b34776
```
19 changes: 0 additions & 19 deletions docs/config.toml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "Add documentation for a handwritten data source"
title: "Add datasource documentation"
summary: "New handwritten datasources require new handwritten documentation to be created."
weight: 25
weight: 61
aliases:
- /docs/how-to/add-handwritten-datasource-documentation
- /how-to/add-handwritten-datasource-documentation
---

# Add documentation for a handwritten data source
# Add data source documentation

{{< hint info >}}
**Note:** If you want to find information about documentation for a generated resource, look at the [MMv1 resource documentation](/magic-modules/docs/how-to/mmv1-resource-documentation) page instead. The information on this page will not be relevant for resources that have generated documentation.
Expand Down
6 changes: 3 additions & 3 deletions docs/content/develop/add-handwritten-datasource.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "Add a handwritten datasource"
title: "Add a datasource"
summary: "Datasources are like terraform resources except they don't *create* anything."
weight: 22
weight: 60
aliases:
- /docs/how-to/add-handwritten-datasource
- /how-to/add-handwritten-datasource
---

# Add a handwritten datasource
# Add a datasource

**Note:** only handwritten datasources are currently supported

Expand Down
54 changes: 0 additions & 54 deletions docs/content/develop/add-handwritten-iam.md

This file was deleted.

18 changes: 9 additions & 9 deletions docs/content/develop/add-handwritten-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Add a handwritten test"
summary: "For handwritten resources and generated resources that need to test update,
handwritten tests must be added."
weight: 21
weight: 41
aliases:
- /docs/how-to/add-handwritten-test
- /how-to/add-handwritten-test
Expand Down Expand Up @@ -63,12 +63,12 @@ For example, the following test case is a good reference:
func TestAccComputeFirewall_noSource(t *testing.T) {
t.Parallel()

networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10))
firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10))
networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10))
firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10))

VcrTest(t, resource.TestCase{
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: ProtoV5ProviderFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -127,12 +127,12 @@ For example:
func TestAccComputeFirewall_disabled(t *testing.T) {
t.Parallel()

networkName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10))
firewallName := fmt.Sprintf("tf-test-firewall-%s", RandString(t, 10))
networkName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10))
firewallName := fmt.Sprintf("tf-test-firewall-%s", acctest.RandString(t, 10))

VcrTest(t, resource.TestCase{
acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: ProtoV5ProviderFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckComputeFirewallDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand Down
112 changes: 0 additions & 112 deletions docs/content/develop/add-mmv1-iam.md

This file was deleted.

Loading

0 comments on commit bcb8009

Please sign in to comment.