mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 08:11:05 -05:00
chore: prepare tests for updates (#6279)
Prepare tests for linters and formatter updates.
This commit is contained in:
parent
f9e2182dc1
commit
6c2f03ffb4
7 changed files with 124 additions and 137 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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}"
|
||||||
|
|
Loading…
Reference in a new issue