chore: prepare tests for updates (#6279)
Some checks are pending
Publish Images / Build and Test (push) Waiting to run
Publish Images / Release (push) Blocked by required conditions
Build and Test / Set build metadata (push) Waiting to run
Build and Test / Build and Test (push) Blocked by required conditions
Build and Test / Test the Super-linter GitHub Action (push) Blocked by required conditions
Build and Test / Build test suite matrix (push) Waiting to run
Build and Test / Run test cases (push) Blocked by required conditions
Build and Test / Check if all the tests passed (push) Blocked by required conditions
Build and Test / preview-release-notes (push) Waiting to run
Lint commit / commitlint (push) Waiting to run

Prepare tests for linters and formatter updates.
This commit is contained in:
Marco Ferrari 2024-11-14 15:29:44 +01:00 committed by GitHub
parent f9e2182dc1
commit 6c2f03ffb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 124 additions and 137 deletions

View file

@ -1,6 +1,6 @@
// https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/config.md // https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/config.md
config { config {
module = false call_module_type = "none"
force = false force = false
} }

View file

@ -270,7 +270,7 @@ GetGitHubVars() {
fatal "Failed to get GITHUB_EVENT_PATH: ${GITHUB_EVENT_PATH}]" fatal "Failed to get GITHUB_EVENT_PATH: ${GITHUB_EVENT_PATH}]"
else else
info "Successfully found GITHUB_EVENT_PATH: ${GITHUB_EVENT_PATH}]" info "Successfully found GITHUB_EVENT_PATH: ${GITHUB_EVENT_PATH}]"
debug "${GITHUB_EVENT_PATH} contents: $(cat "${GITHUB_EVENT_PATH}")" debug "${GITHUB_EVENT_PATH} contents:\n$(cat "${GITHUB_EVENT_PATH}")"
fi fi
if [ -z "${GITHUB_SHA:-}" ]; then if [ -z "${GITHUB_SHA:-}" ]; then

View file

@ -4,25 +4,16 @@ set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
# Default log level
# shellcheck disable=SC2034
LOG_LEVEL="DEBUG"
# shellcheck source=/dev/null # shellcheck source=/dev/null
source "lib/functions/log.sh" source "test/testUtils.sh"
DEFAULT_BRANCH=main
git config --global init.defaultBranch "${DEFAULT_BRANCH}"
git config --global user.email "super-linter@example.com"
git config --global user.name "Super-linter"
function InitGitRepositoryAndCommitFiles() { function InitGitRepositoryAndCommitFiles() {
local REPOSITORY_PATH="${1}" && shift local REPOSITORY_PATH="${1}" && shift
local FILES_TO_COMMIT="${1}" && shift local FILES_TO_COMMIT="${1}" && shift
local COMMIT_FILE_INITIAL_COMMIT="${1}" local COMMIT_FILE_INITIAL_COMMIT="${1}"
git -C "${REPOSITORY_PATH}" init initialize_git_repository "${REPOSITORY_PATH}"
if [[ "${COMMIT_FILE_INITIAL_COMMIT}" == "true" ]]; then if [[ "${COMMIT_FILE_INITIAL_COMMIT}" == "true" ]]; then
touch "${REPOSITORY_PATH}/test-initial-commit.txt" touch "${REPOSITORY_PATH}/test-initial-commit.txt"
git -C "${REPOSITORY_PATH}" add . git -C "${REPOSITORY_PATH}" add .
@ -50,9 +41,6 @@ function InitGitRepositoryAndCommitFiles() {
function GenerateFileDiffOneFileTest() { function GenerateFileDiffOneFileTest() {
local GITHUB_WORKSPACE local GITHUB_WORKSPACE
GITHUB_WORKSPACE="$(mktemp -d)" GITHUB_WORKSPACE="$(mktemp -d)"
# shellcheck disable=SC2064 # Once the path is set, we don't expect it to change
trap "rm -fr '${GITHUB_WORKSPACE}'" EXIT
debug "GITHUB_WORKSPACE: ${GITHUB_WORKSPACE}"
local FILES_TO_COMMIT="${FILES_TO_COMMIT:-1}" local FILES_TO_COMMIT="${FILES_TO_COMMIT:-1}"
local COMMIT_FILE_INITIAL_COMMIT="${COMMIT_FILE_INITIAL_COMMIT:-"false"}" local COMMIT_FILE_INITIAL_COMMIT="${COMMIT_FILE_INITIAL_COMMIT:-"false"}"
@ -92,9 +80,6 @@ function GenerateFileDiffInitialCommitPushEventTest() {
function GenerateFileDiffTwoFilesTest() { function GenerateFileDiffTwoFilesTest() {
local GITHUB_WORKSPACE local GITHUB_WORKSPACE
GITHUB_WORKSPACE="$(mktemp -d)" GITHUB_WORKSPACE="$(mktemp -d)"
# shellcheck disable=SC2064 # Once the path is set, we don't expect it to change
trap "rm -fr '${GITHUB_WORKSPACE}'" EXIT
debug "GITHUB_WORKSPACE: ${GITHUB_WORKSPACE}"
local FILES_TO_COMMIT=2 local FILES_TO_COMMIT=2
InitGitRepositoryAndCommitFiles "${GITHUB_WORKSPACE}" ${FILES_TO_COMMIT} "false" InitGitRepositoryAndCommitFiles "${GITHUB_WORKSPACE}" ${FILES_TO_COMMIT} "false"

View file

@ -2,6 +2,8 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <string>
using std::string; using std::string;
int main() { int main() {

View file

@ -12,8 +12,6 @@ TEST_FUNCTION_NAME="${2}"
SUPER_LINTER_CONTAINER_IMAGE_TYPE="${3}" SUPER_LINTER_CONTAINER_IMAGE_TYPE="${3}"
debug "Super-linter container image type: ${SUPER_LINTER_CONTAINER_IMAGE_TYPE}" debug "Super-linter container image type: ${SUPER_LINTER_CONTAINER_IMAGE_TYPE}"
DEFAULT_BRANCH="main"
COMMAND_TO_RUN=(docker run --rm -t -e DEFAULT_BRANCH="${DEFAULT_BRANCH}" -e ENABLE_GITHUB_ACTIONS_GROUP_TITLE="true") COMMAND_TO_RUN=(docker run --rm -t -e DEFAULT_BRANCH="${DEFAULT_BRANCH}" -e ENABLE_GITHUB_ACTIONS_GROUP_TITLE="true")
ignore_test_cases() { ignore_test_cases() {

View file

@ -96,6 +96,8 @@ LANGUAGES_NOT_IN_SLIM_IMAGE=(
"RUST_CLIPPY" "RUST_CLIPPY"
) )
DEFAULT_BRANCH="main"
function AssertArraysElementsContentMatch() { function AssertArraysElementsContentMatch() {
local ARRAY_1_VARIABLE_NAME="${1}" local ARRAY_1_VARIABLE_NAME="${1}"
local ARRAY_2_VARIABLE_NAME="${2}" local ARRAY_2_VARIABLE_NAME="${2}"