Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/ci-test-limited-with-count.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ jobs:
working-directory: "."
run: |
sudo /etc/init.d/ssh stop ;
sudo systemctl disable --now ssh.socket
mkdir -p ~/git-server/keys
docker run --name test-event-driver -d -p 22:22 -p 5001:5001 -p 3306:3306 \
-p 5433:5432 -p 28017:27017 -p 25:25 -p 4200:4200 -p 5000:5000 -p 3001:3000 -p 6001:6001 -p 8001:8000 --privileged --pid=host --ipc=host --volume /:/host -v ~/git-server/keys:/git-server/keys \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-test-limited.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ jobs:
working-directory: "."
run: |
sudo /etc/init.d/ssh stop ;
sudo systemctl disable --now ssh.socket
mkdir -p ~/git-server/keys
docker run --name test-event-driver -d -p 22:22 -p 5001:5001 -p 3306:3306 \
-p 5433:5432 -p 28017:27017 -p 25:25 -p 4200:4200 -p 5000:5000 -p 3001:3000 -p 6001:6001 -p 8001:8000 --privileged --pid=host --ipc=host --volume /:/host -v ~/git-server/keys:/git-server/keys \
Expand Down
199 changes: 99 additions & 100 deletions .github/workflows/server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defaults:

jobs:
server-unit-tests:
runs-on: ubuntu-latest-8-cores
runs-on: ubuntu-22.04-8core

# Service containers to run with this job. Required for running tests
services:
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:

- name: Figure out the PR number
run: echo ${{ inputs.pr }}

- name: Default database URL
run: echo "Is this a PG build? ${{ inputs.is-pg-build }}"

Expand Down Expand Up @@ -203,105 +203,104 @@ jobs:
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
APPSMITH_VERBOSE_LOGGING_ENABLED: false
run: |
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi

args=()

if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
fi

# Run tests and capture logs
mvn test "${args[@]}" | tee mvn_test.log

# Check for "BUILD FAILURE" in the mvn_test.log
if grep -q "BUILD FAILURE" mvn_test.log; then
test_result="failed"
else
test_result="passed"
fi

echo "test_result variable value: ${test_result}"

# Prepare output file for failed tests and ensure a fresh file is created
OUTPUT_FILE="failed-server-tests.txt"
rm -f "$OUTPUT_FILE"
touch "$OUTPUT_FILE"

failed_modules=()
skipped_modules=()

# Process mvn_test.log for FAILURE and SKIPPED statuses
while IFS= read -r line; do
if [[ $line == *"FAILURE"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
failed_modules+=("$module_name")
elif [[ $line == *"SKIPPED"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
skipped_modules+=("$module_name")
fi
done < mvn_test.log

echo "Failed Modules: ${failed_modules[*]}"
echo "Skipped Modules: ${skipped_modules[*]}"

# Handle older approach for reading failed tests from XML files
failed_tests_from_xml="$PWD/failed-tests-from-xml.txt"
gawk -F\" '/<testcase / {cur_test = $4 "#" $2} /<(failure|error) / {print cur_test}' $(find . -type f -name 'TEST-*.xml') \
| sort -u \
| tee "$failed_tests_from_xml"

# Filter out failed modules and add only relevant tests to the final failed list
for module in "${failed_modules[@]}"; do
grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml"
done

# Include all skipped module test files in the final list
for module in "${skipped_modules[@]}"; do
module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u)
for module_directory in $module_directories; do
test_classes=$(find "$module_directory" -type f -name "*Test.java" | sed 's|.*/src/test/java/||; s|\.java$||; s|/|.|g')
for class_name in $test_classes; do
if [[ ${#class_name} -le 240 ]] && ! grep -Fxq "$class_name#" "$OUTPUT_FILE"; then
echo "${class_name}#" >> "$OUTPUT_FILE"
fi
done
done
done

# Combine the XML file test cases and skipped module test files into the final output file
cat "$failed_tests_from_xml" >> "$OUTPUT_FILE"

# Print the final output
cat "$OUTPUT_FILE"

if [[ -s $OUTPUT_FILE ]]; then
content="$(
echo "## Failed server tests"
echo
sed 's/^/- /' "$OUTPUT_FILE"
)"
echo "$content" >> "$GITHUB_STEP_SUMMARY"

# Post a comment to the PR
curl --silent --show-error \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
> /dev/null
fi

# Fail the script if tests did not pass
if [[ "$test_result" == "failed" ]]; then
echo "Tests failed, exiting with status 1."
exit 1
fi
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi

args=()

if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
fi

# Run tests and capture logs
mvn test "${args[@]}" | tee mvn_test.log

# Check for "BUILD FAILURE" in the mvn_test.log
if grep -q "BUILD FAILURE" mvn_test.log; then
test_result="failed"
else
test_result="passed"
fi

echo "test_result variable value: ${test_result}"

# Prepare output file for failed tests and ensure a fresh file is created
OUTPUT_FILE="failed-server-tests.txt"
rm -f "$OUTPUT_FILE"
touch "$OUTPUT_FILE"

failed_modules=()
skipped_modules=()

# Process mvn_test.log for FAILURE and SKIPPED statuses
while IFS= read -r line; do
if [[ $line == *"FAILURE"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
failed_modules+=("$module_name")
elif [[ $line == *"SKIPPED"* ]]; then
module_name=$(echo "$line" | awk '{print $2}')
skipped_modules+=("$module_name")
fi
done < mvn_test.log

echo "Failed Modules: ${failed_modules[*]}"
echo "Skipped Modules: ${skipped_modules[*]}"

# Handle older approach for reading failed tests from XML files
failed_tests_from_xml="$PWD/failed-tests-from-xml.txt"
gawk -F\" '/<testcase / {cur_test = $4 "#" $2} /<(failure|error) / {print cur_test}' $(find . -type f -name 'TEST-*.xml') \
| sort -u \
| tee "$failed_tests_from_xml"

# Filter out failed modules and add only relevant tests to the final failed list
for module in "${failed_modules[@]}"; do
grep -v "$module" "$failed_tests_from_xml" > temp_file && mv temp_file "$failed_tests_from_xml"
done

# Include all skipped module test files in the final list
for module in "${skipped_modules[@]}"; do
module_directories=$(find . -path "*/${module}*/src/test/java/*" -type f -name "*Test.java" -exec dirname {} \; | sort -u)
for module_directory in $module_directories; do
test_classes=$(find "$module_directory" -type f -name "*Test.java" | sed 's|.*/src/test/java/||; s|\.java$||; s|/|.|g')
for class_name in $test_classes; do
if [[ ${#class_name} -le 240 ]] && ! grep -Fxq "$class_name#" "$OUTPUT_FILE"; then
echo "${class_name}#" >> "$OUTPUT_FILE"
fi
done
done
done

# Combine the XML file test cases and skipped module test files into the final output file
cat "$failed_tests_from_xml" >> "$OUTPUT_FILE"

# Print the final output
cat "$OUTPUT_FILE"

if [[ -s $OUTPUT_FILE ]]; then
content="$(
echo "## Failed server tests"
echo
sed 's/^/- /' "$OUTPUT_FILE"
)"
echo "$content" >> "$GITHUB_STEP_SUMMARY"

# Post a comment to the PR
curl --silent --show-error \
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data "$(jq -n --arg body "$content" '$ARGS.named')" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/${{ inputs.pr }}/comments" \
> /dev/null
fi

# Fail the script if tests did not pass
if [[ "$test_result" == "failed" ]]; then
echo "Tests failed, exiting with status 1."
exit 1
fi

# Set status = failedtest
- name: Set fail if there are test failures
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/server-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
run-tests:
runs-on: ubuntu-latest-8-cores
runs-on: ubuntu-22.04-8core
if: |
github.event.pull_request.head.repo.full_name == github.repository ||
github.event_name == 'workflow_dispatch'
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
with:
name: server-build
path: app/server/dist/

- name: Download the rts build artifact
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -93,16 +93,14 @@ jobs:
APPSMITH_ENVFILE_PATH: /tmp/dummy.env
APPSMITH_VERBOSE_LOGGING_ENABLED: false
run: |
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi

args=()

# Run tests and capture logs
cd app/server
mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log
if [[ "${{ inputs.is-pg-build }}" == "true" ]]; then
export APPSMITH_DB_URL="postgresql://postgres:password@localhost:5432/postgres"
else
export APPSMITH_DB_URL="mongodb://localhost:27017/mobtools"
fi

args=()

# Run tests and capture logs
cd app/server
mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log
4 changes: 2 additions & 2 deletions .github/workflows/test-build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ run-name: >
${{ github.workflow }} with TED:${{ inputs.ted_tag || 'latest' }}

on:
# This workflow will run everyday at 7:00AM, 1:00PM IST on weekdays
# This workflow will run everyday at 7:00AM, 11:00AM and 3:00PM IST on weekdays
schedule:
- cron: "30 1-12/6 * * 1-5"
- cron: "30 1-11/4 * * 1-5"
# This line enables manual triggering of this workflow.
workflow_dispatch:
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from "../../../../support/Objects/ObjectsCore";
import { CURRENT_REPO, REPO } from "../../../../fixtures/REPO";
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags";
import AdminsSettings from "../../../../locators/AdminsSettings";

describe(
"Admin Settings Page - General page validations",
Expand All @@ -12,13 +13,15 @@ describe(
it("1. TC# 2439 Verify 'Page title' changes upon changing Instance name", () => {
featureFlagIntercept({ license_branding_enabled: true });
adminSettings.NavigateToAdminSettings();
agHelper.WaitUntilEleAppear(adminSettings._instanceName);
agHelper.ClearNType(adminSettings._instanceName, "Testing Instance name");
agHelper.ClickButton("Save");
agHelper.ClickOutside();
agHelper.GetNClick(AdminsSettings.saveButton, 0, true);
agHelper.ValidateToastMessage("Successfully saved");
if (CURRENT_REPO === REPO.CE) cy.title().should("eq", "Appsmith");
//verifying that Instance name is not changed in CE
else if (CURRENT_REPO === REPO.EE)
cy.title().should("eq", "Testing Instance name"); //verifying that Instance name is not changed in EE
cy.title().should("eq", "Testing Instance name"); //verifying that Instance name is changed in EE
});
it("2. TC# 2439 Verify 'Page title' does not change upon changing Instance name in free plan", () => {
featureFlagIntercept({ license_branding_enabled: false });
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/fixtures/testdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"noBodyErrorMessageDiv": "#NoBodyMessageDiv",
"noBodyErrorMessage": "This request does not have a body",
"v2Key": "6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI",
"v3Key": "6LcnzQgfAAAAAMwMlQLppqx7STvZ6pZJoDMXti8k",
"v3Key": "6LcUj7gqAAAAALqbrlt_ZQ2NiO4fQns05nNFg3EX",
"invalidKey": "abc123",
"errorMsg": "Google reCAPTCHA token generation failed! Please check the reCAPTCHA site key.",
"treeTextBindingValue": "{{TreeSelect1.selectedOptionValue}}",
Expand Down
1 change: 0 additions & 1 deletion app/client/cypress/support/Objects/FeatureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import produce from "immer";
const defaultFlags = {
release_side_by_side_ide_enabled: true,
rollout_remove_feature_walkthrough_enabled: false, // remove this flag from here when it's removed from code
release_actions_redesign_enabled: true,
release_git_modularisation_enabled: true,
};

Expand Down
Loading