From 8daf5ddb5204ed6c9673e31c1af47973ee22c496 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:19:08 -0800 Subject: [PATCH 01/22] Remove local version related rules and scripts --- Makefile | 9 +--- Script/update-versions.sh | 99 --------------------------------------- Script/version.sh | 29 ------------ 3 files changed, 1 insertion(+), 136 deletions(-) delete mode 100755 Script/update-versions.sh delete mode 100755 Script/version.sh diff --git a/Makefile b/Makefile index c9e6a370..dd67f6d3 100644 --- a/Makefile +++ b/Makefile @@ -149,15 +149,8 @@ lint-autocorrect: lint: ./Pods/SwiftLint/swiftlint lint Sources TestApps -# make check-version VERSION=5.0.0 -check-version: - sh ./Script/version.sh $(VERSION) - test-SPM-integration: sh ./Script/test-SPM.sh test-podspec: - sh ./Script/test-podspec.sh - -test-version-update: - sh ./Script/update-versions.sh -n Edge -v 9.9.9 + sh ./Script/test-podspec.sh \ No newline at end of file diff --git a/Script/update-versions.sh b/Script/update-versions.sh deleted file mode 100755 index 8ab6712e..00000000 --- a/Script/update-versions.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# make this script executable from terminal: -# chmod 755 update-versions.sh - -set -e # Any subsequent(*) commands which fail will cause the shell script to exit immediately - -ROOT_DIR=$(git rev-parse --show-toplevel) -LINE="================================================================================" -VERSION_REGEX="[0-9]+\.[0-9]+\.[0-9]+" -DEPENDENCIES=none - -# make a "dictionary" to help us find the correct spm repo per dependency (if necessary) -# IMPORTANT - this will be used in a regex search so escape special chars -# usage : -# getRepo AEPCore - -declare "repos_AEPCore=https:\/\/github\.com\/adobe\/aepsdk-core-ios\.git" -declare "repos_AEPEdgeIdentity=https:\/\/github\.com\/adobe\/aepsdk-edgeidentity-ios\.git" -getRepo() { - local extensionName=$1 - local url="repos_$extensionName" - echo "${!url}" -} - -help() -{ - echo "" - echo "Usage: $0 -n EXTENSION_NAME -v NEW_VERSION -d \"PODSPEC_DEPENDENCY_1, PODSPEC_DEPENDENCY_2\"" - echo "" - echo -e " -n\t- Name of the extension getting a version update. \n\t Example: Edge, Analytics\n" - echo -e " -v\t- New version to use for the extension. \n\t Example: 3.0.2\n" - echo -e " -d (optional)\t- Dependency(ies) that require updating in the extension's podspec and Package.swift file. \n\t Example: -d \"AEPCore 3.7.3\" (update the dependency on AEPCore to version 3.7.3 or newer)\n" - exit 1 # Exit script after printing help -} - -while getopts "n:v:d:" opt -do - case "$opt" in - n ) NAME="$OPTARG" ;; - v ) NEW_VERSION="$OPTARG" ;; - d ) DEPENDENCIES="$OPTARG" ;; - ? ) help ;; # Print help in case parameter is non-existent - esac -done - -# Print help in case parameters are empty -if [ -z "$NAME" ] || [ -z "$NEW_VERSION" ] -then - echo "********** USAGE ERROR **********" - echo "Some or all of the parameters are empty. See usage below:"; - help -fi - -PODSPEC_FILE=$ROOT_DIR"/AEP"$NAME.podspec -SPM_FILE=$ROOT_DIR/Package.swift - -# Begin script when all parameters are correct -echo "" -echo "$LINE" -echo "Changing version of AEP$NAME to $NEW_VERSION with the following minimum version dependencies: $DEPENDENCIES" -echo "$LINE" - -# Replace extension version in podspec -echo "Changing value of 's.version' to '$NEW_VERSION' in '$PODSPEC_FILE'" -sed -i '' -E "/^ *s.version/{s/$VERSION_REGEX/$NEW_VERSION/;}" $PODSPEC_FILE - -# Replace dependencies in podspec and Package.swift -if [ "$DEPENDENCIES" != "none" ]; then - IFS="," - dependenciesArray=($(echo "$DEPENDENCIES")) - - IFS=" " - for dependency in "${dependenciesArray[@]}"; do - dependencyArray=(${dependency// / }) - dependencyName=${dependencyArray[0]} - dependencyVersion=${dependencyArray[1]} - - if [ "$dependencyVersion" != "" ]; then - echo "Changing value of 's.dependency' for '$dependencyName' to '>= $dependencyVersion' in '$PODSPEC_FILE'" - sed -i '' -E "/^ *s.dependency +'$dependencyName'/{s/$VERSION_REGEX/$dependencyVersion/;}" $PODSPEC_FILE - - spmRepoUrl=$(getRepo $dependencyName) - if [ "$spmRepoUrl" != "" ]; then - echo "Changing value of '.upToNextMajor(from:)' for '$spmRepoUrl' to '$dependencyVersion' in '$SPM_FILE'" - sed -i '' -E "/$spmRepoUrl\", \.upToNextMajor/{s/$VERSION_REGEX/$dependencyVersion/;}" $SPM_FILE - fi - fi - done -fi - -# Replace version in Constants file -CONSTANTS_FILE=$ROOT_DIR"/Sources/"$NAME"Constants.swift" -echo "Changing value of 'EXTENSION_VERSION' to '$NEW_VERSION' in '$CONSTANTS_FILE'" -sed -i '' -E "/^ +static let EXTENSION_VERSION/{s/$VERSION_REGEX/$NEW_VERSION/;}" $CONSTANTS_FILE - -# Replace marketing versions in project.pbxproj -PROJECT_PBX_FILE=$ROOT_DIR"/AEP$NAME.xcodeproj/project.pbxproj" -echo "Changing value of 'MARKETING_VERSION' to '$NEW_VERSION' in '$PROJECT_PBX_FILE'" -sed -i '' -E "/^\t+MARKETING_VERSION = /{s/$VERSION_REGEX/$NEW_VERSION/;}" $PROJECT_PBX_FILE diff --git a/Script/version.sh b/Script/version.sh deleted file mode 100755 index dc6e35b5..00000000 --- a/Script/version.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if which jq >/dev/null; then - echo "jq is installed" -else - echo "error: jq not installed.(brew install jq)" -fi - -NC='\033[0m' -RED='\033[0;31m' -GREEN='\033[0;32m' -BLUE='\033[0;34m' - -echo "Target version - ${BLUE}$1${NC}" -echo "------------------AEPEdge-------------------" -PODSPEC_VERSION_IN_AEPEdge=$(pod ipc spec AEPEdge.podspec | jq '.version' | tr -d '"') -echo "Local podspec version - ${BLUE}${PODSPEC_VERSION_IN_AEPEdge}${NC}" -SOUCE_CODE_VERSION_IN_AEPEdge=$(cat ./Sources/EdgeConstants.swift | egrep '\s*EXTENSION_VERSION\s*=\s*\"(.*)\"' | ruby -e "puts gets.scan(/\"(.*)\"/)[0] " | tr -d '"') -echo "Souce code version - ${BLUE}${SOUCE_CODE_VERSION_IN_AEPEdge}${NC}" - -if [[ "$1" == "$PODSPEC_VERSION_IN_AEPEdge" ]] && [[ "$1" == "$SOUCE_CODE_VERSION_IN_AEPEdge" ]]; then - echo "${GREEN}Pass!${NC}" -else - echo "${RED}[Error]${NC} Version do not match!" - exit -1 -fi -exit 0 From 4f1405b9f0935e00f174110a58e8c934cd69a533 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:26:43 -0800 Subject: [PATCH 02/22] Test removing resultBundlePath flag --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dd67f6d3..2d41ec06 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ unit-test-ios: @echo "### Unit Testing iOS" @echo "######################################################################" rm -rf build/reports/iosUnitResults.xcresult - xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "UnitTests" -destination "platform=iOS Simulator,name=iPhone 15" -derivedDataPath build/out -resultBundlePath build/reports/iosUnitResults.xcresult -enableCodeCoverage YES ADB_SKIP_LINT=YES + xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "UnitTests" -destination "platform=iOS Simulator,name=iPhone 16" -derivedDataPath build/out -enableCodeCoverage YES ADB_SKIP_LINT=YES functional-test-ios: @echo "######################################################################" From daa7b9e4d0ef7bbdc89869b3caedbc393460952c Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:56:06 -0800 Subject: [PATCH 03/22] TEST: versions-update branch compatibility with original versions usage --- .github/workflows/update-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index effdefa3..44f86919 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -30,7 +30,7 @@ jobs: permissions: contents: write pull-requests: write - uses: adobe/aepsdk-commons/.github/workflows/versions.yml@gha-ios-5.0.0 + uses: timkimadobe/aepsdk-commons/.github/workflows/versions.yml@versions-update with: version: ${{ github.event.inputs.version }} branch: ${{ github.event.inputs.branch }} From 695ac287a048561159f5557d53d950622c7195b9 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:32:15 -0800 Subject: [PATCH 04/22] Apply prod config --- .github/workflows/update-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index 44f86919..effdefa3 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -30,7 +30,7 @@ jobs: permissions: contents: write pull-requests: write - uses: timkimadobe/aepsdk-commons/.github/workflows/versions.yml@versions-update + uses: adobe/aepsdk-commons/.github/workflows/versions.yml@gha-ios-5.0.0 with: version: ${{ github.event.inputs.version }} branch: ${{ github.event.inputs.branch }} From 3e6328d3a44436b8ff323a715be22dc6206a809a Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Fri, 15 Nov 2024 13:47:09 -0800 Subject: [PATCH 05/22] Update Makefile test rules for configurable device and OS This supports command line args updating the device and OS to test with, and also enables CI matrix support --- Makefile | 64 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 2d41ec06..a55c2f04 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,48 @@ TVOS_SIMULATOR_ARCHIVE_DSYM_PATH = $(CURR_DIR)/build/tvos_simulator.xcarchive/dS TVOS_ARCHIVE_PATH = $(CURR_DIR)/build/tvos.xcarchive/Products/Library/Frameworks/ TVOS_ARCHIVE_DSYM_PATH = $(CURR_DIR)/build/tvos.xcarchive/dSYMs/ +# Values with defaults +IOS_DEVICE_NAME ?= iPhone 15 +# If OS version is not specified, uses the first device name match in the list of available simulators +IOS_VERSION ?= +ifeq ($(strip $(IOS_VERSION)),) + IOS_DESTINATION = "platform=iOS Simulator,name=$(IOS_DEVICE_NAME)" +else + IOS_DESTINATION = "platform=iOS Simulator,name=$(IOS_DEVICE_NAME),OS=$(IOS_VERSION)" +endif + +TVOS_DEVICE_NAME ?= Apple TV +# If OS version is not specified, uses the first device name match in the list of available simulators +TVOS_VERSION ?= +ifeq ($(strip $(TVOS_VERSION)),) + TVOS_DESTINATION = "platform=tvOS Simulator,name=$(TVOS_DEVICE_NAME)" +else + TVOS_DESTINATION = "platform=tvOS Simulator,name=$(TVOS_DEVICE_NAME),OS=$(TVOS_VERSION)" +endif + +clean-derived-data: + @if [ -z "$(SCHEME)" ]; then \ + echo "Error: SCHEME variable is not set."; \ + exit 1; \ + fi; \ + if [ -z "$(DESTINATION)" ]; then \ + echo "Error: DESTINATION variable is not set."; \ + exit 1; \ + fi; \ + echo "Cleaning derived data for scheme: $(SCHEME) with destination: $(DESTINATION)"; \ + DERIVED_DATA_PATH=`xcodebuild -workspace $(PROJECT_NAME).xcworkspace -scheme "$(SCHEME)" -destination "$(DESTINATION)" -showBuildSettings | grep -m1 'BUILD_DIR' | awk '{print $$3}' | sed 's|/Build/Products||'`; \ + echo "DerivedData Path: $$DERIVED_DATA_PATH"; \ + \ + LOGS_TEST_DIR=$$DERIVED_DATA_PATH/Logs/Test; \ + echo "Logs Test Path: $$LOGS_TEST_DIR"; \ + \ + if [ -d "$$LOGS_TEST_DIR" ]; then \ + echo "Removing existing .xcresult files in $$LOGS_TEST_DIR"; \ + rm -rf "$$LOGS_TEST_DIR"/*.xcresult; \ + else \ + echo "Logs/Test directory does not exist. Skipping cleanup."; \ + fi; + setup-tools: install-githook setup: @@ -91,29 +133,29 @@ unit-test-ios: @echo "######################################################################" @echo "### Unit Testing iOS" @echo "######################################################################" - rm -rf build/reports/iosUnitResults.xcresult - xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "UnitTests" -destination "platform=iOS Simulator,name=iPhone 16" -derivedDataPath build/out -enableCodeCoverage YES ADB_SKIP_LINT=YES + @$(MAKE) clean-derived-data SCHEME=UnitTests DESTINATION=$(IOS_DESTINATION) + xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "UnitTests" -destination $(IOS_DESTINATION) -enableCodeCoverage YES ADB_SKIP_LINT=YES functional-test-ios: @echo "######################################################################" @echo "### Functional Testing iOS" @echo "######################################################################" - rm -rf build/reports/iosFunctionalResults.xcresult - xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "FunctionalTests" -destination "platform=iOS Simulator,name=iPhone 15" -derivedDataPath build/out -resultBundlePath build/reports/iosFunctionalResults.xcresult -enableCodeCoverage YES ADB_SKIP_LINT=YES + @$(MAKE) clean-derived-data SCHEME=FunctionalTests DESTINATION=$(IOS_DESTINATION) + xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "FunctionalTests" -destination $(IOS_DESTINATION) -enableCodeCoverage YES ADB_SKIP_LINT=YES unit-test-tvos: @echo "######################################################################" @echo "### Unit Testing tvOS" @echo "######################################################################" - rm -rf build/reports/tvosUnitResults.xcresult - xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "UnitTests" -destination 'platform=tvOS Simulator,name=Apple TV' -derivedDataPath build/out -resultBundlePath build/reports/tvosUnitResults.xcresult -enableCodeCoverage YES ADB_SKIP_LINT=YES + @$(MAKE) clean-derived-data SCHEME=UnitTests DESTINATION=$(TVOS_DESTINATION) + xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "UnitTests" -destination $(TVOS_DESTINATION) -enableCodeCoverage YES ADB_SKIP_LINT=YES functional-test-tvos: @echo "######################################################################" @echo "### Functional Testing tvOS" @echo "######################################################################" - rm -rf build/reports/tvosFunctionalResults.xcresult - xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "FunctionalTests" -destination 'platform=tvOS Simulator,name=Apple TV' -derivedDataPath build/out -resultBundlePath build/reports/tvosFunctionalResults.xcresult -enableCodeCoverage YES ADB_SKIP_LINT=YES + @$(MAKE) clean-derived-data SCHEME=FunctionalTests DESTINATION=$(TVOS_DESTINATION) + xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "FunctionalTests" -destination $(TVOS_DESTINATION) -enableCodeCoverage YES ADB_SKIP_LINT=YES # Runs the Edge Network (Konductor) integration tests after installing pod dependencies # Usage: @@ -121,7 +163,7 @@ functional-test-tvos: # If MOBILE_PROPERTY_ID is not specified, test target will use its default value. .SILENT: test-integration-upstream # Silences Makefile's automatic echo of commands test-integration-upstream: pod-install; \ - rm -rf build/reports/iosIntegrationUpstreamResults.xcresult; \ + @$(MAKE) clean-derived-data SCHEME=UpstreamIntegrationTests DESTINATION=$(IOS_DESTINATION) if [ -z "$$EDGE_ENVIRONMENT" ]; then \ echo ''; \ echo '-------------------------- WARNING -------------------------------'; \ @@ -132,9 +174,7 @@ test-integration-upstream: pod-install; \ xcodebuild test \ -workspace $(PROJECT_NAME).xcworkspace \ -scheme UpstreamIntegrationTests \ - -destination 'platform=iOS Simulator,name=iPhone 15' \ - -derivedDataPath build/out \ - -resultBundlePath build/reports/iosIntegrationUpstreamResults.xcresult \ + -destination $(IOS_DESTINATION) \ -enableCodeCoverage YES \ ADB_SKIP_LINT=YES \ TAGS_MOBILE_PROPERTY_ID=$(TAGS_MOBILE_PROPERTY_ID) \ From 8342c7d0beae7aafb30351fd99183c3879e874db Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:28:11 -0800 Subject: [PATCH 06/22] Replace CircleCI with GitHub Actions reusable workflow --- .circleci/config.yml | 205 --------------------------- .github/workflows/build-and-test.yml | 21 +++ 2 files changed, 21 insertions(+), 205 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build-and-test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e9b8a4b1..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,205 +0,0 @@ -# For a detailed guide to building and testing on iOS, read the docs: -# https://circleci.com/docs/2.0/testing-ios/ - -version: 2.1 - -orbs: - # codecov: codecov/codecov@3.2.5 - macos: circleci/macos@2 - -# Workflows orchestrate a set of jobs to be run -workflows: - build-test: - jobs: - - validate-code - - test-ios: - requires: - - validate-code - - test-tvos: - requires: - - validate-code - # The following jobs are conditional on branch name - - test-ios-integration: - requires: - - validate-code - filters: - branches: - only: - - main - - staging - - build_xcframework_and_app: - requires: - - validate-code - filters: - branches: - only: - - main - - staging - -commands: - install_dependencies: - steps: - # restore pods related caches - - restore_cache: - name: Restoring Gemfile Cache - keys: - - 1-gems-{{ checksum "Gemfile.lock" }} - - # make sure we're on the right version of cocoapods - - run: - name: Verify Cocoapods Version - command: bundle check || bundle install --path vendor/bundle - - # save cocoapods version gem data - - save_cache: - name: Saving Gemfile Cache - key: 1-gems-{{ checksum "Gemfile.lock" }} - paths: - - vendor/bundle - - # restore pods related caches - - restore_cache: - name: Restoring CocoaPods Cache - keys: - - cocoapods-cache-v6-{{ arch }}-{{ .Branch }}-{{ checksum "Podfile.lock" }} - - cocoapods-cache-v6-{{ arch }}-{{ .Branch }} - - cocoapods-cache-v6 - - # install CocoaPods - using default CocoaPods version, not the bundle - - run: - name: Repo Update & Install CocoaPods - command: make ci-pod-install - - # save pods related files - - save_cache: - name: Saving CocoaPods Cache - key: cocoapods-cache-v6-{{ arch }}-{{ .Branch }}-{{ checksum "Podfile.lock" }} - paths: - - ./Pods - - ./SampleApps/TestApp/Pods - - ~/.cocoapods - - prestart_ios_simulator: - steps: - - macos/preboot-simulator: - platform: "iOS" - version: "17.2" - device: "iPhone 15" - - prestart_tvos_simulator: - steps: - - macos/preboot-simulator: - platform: "tvOS" - version: "17.2" - device: "Apple TV" - -jobs: - validate-code: - macos: - xcode: 15.1.0 # Specify the Xcode version to use - - steps: - - checkout - - - install_dependencies - - - run: - name: Lint Source Code - command: make lint - - test-ios: - macos: - xcode: 15.1.0 # Specify the Xcode version to use - resource_class: macos.m1.medium.gen1 - - steps: - - checkout - - - install_dependencies - - - prestart_ios_simulator - - - run: - name: Run iOS Unit Tests - command: make unit-test-ios - - # Code coverage upload using Codecov - # See options explanation here: https://docs.codecov.com/docs/codecov-uploader - # - codecov/upload: - # flags: ios-unit-tests - # upload_name: Coverage report for iOS unit tests - # xtra_args: -c -v --xc --xp build/reports/iosUnitResults.xcresult - - - run: - name: Run iOS Functional Tests - command: make functional-test-ios - when: always # run even if unit tests fail - - # - codecov/upload: - # flags: ios-functional-tests - # upload_name: Coverage report for iOS functional tests - # xtra_args: -c -v --xc --xp build/reports/iosFunctionalResults.xcresult - - test-ios-integration: - macos: - xcode: 15.1.0 # Specify the Xcode version to use - - steps: - - checkout - - - install_dependencies - - - prestart_ios_simulator - - - run: - name: Run iOS integration tests - command: make test-integration-upstream - - test-tvos: - macos: - xcode: 15.1.0 # Specify the Xcode version to use - resource_class: macos.m1.medium.gen1 - - steps: - - checkout - - - install_dependencies - - - prestart_tvos_simulator - - - run: - name: Run tvOS Unit Tests - command: make unit-test-tvos - - # Code coverage upload using Codecov - # See options explanation here: https://docs.codecov.com/docs/codecov-uploader - # - codecov/upload: - # flags: tvos-unit-tests - # upload_name: Coverage report for tvOS unit tests - # xtra_args: -c -v --xc --xp build/reports/tvosUnitResults.xcresult - - - run: - name: Run tvOS Functional Tests - command: make functional-test-tvos - when: always # run even if unit tests fail - - # - codecov/upload: - # flags: tvos-functional-tests - # upload_name: Coverage report for tvOS functional tests - # xtra_args: -c -v --xc --xp build/reports/tvosFunctionalResults.xcresult - - build_xcframework_and_app: - macos: - xcode: 15.1.0 # Specify the Xcode version to use - - steps: - - checkout - # Verify XCFramework archive builds - - run: - name: Build XCFramework - command: make archive - # verify test app builds - - run: - name: Build Test App - command: make build-app - diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 00000000..ebdb7d6f --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,21 @@ +name: Build and Test + +on: + pull_request: + +jobs: + build-and-test: + name: " " + uses: timkimadobe/aepsdk-commons/.github/workflows/ios-build-and-test.yml@gha-ios-5.0.0 + with: + ios-device-names: '["iPhone 15"]' + ios-versions: '["18.1"]' + tvos-device-names: '["Apple TV"]' + tvos-versions: '["18.1"]' + run-test-ios-unit: true + run-test-ios-functional: true + run-test-ios-integration: true + run-test-tvos-unit: true + run-test-tvos-functional: true + run-build-xcframework-and-app: true + secrets: inherit \ No newline at end of file From c0913768102ace250e43fab12c64cc3d324d9f01 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:50:53 -0800 Subject: [PATCH 07/22] Add license headers to workflow files --- .github/workflows/build-and-test.yml | 12 ++++++++++++ .github/workflows/release.yml | 12 ++++++++++++ .github/workflows/update-versions.yml | 12 ++++++++++++ .github/workflows/upstream-integration-test.yml | 12 ++++++++++++ 4 files changed, 48 insertions(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ebdb7d6f..c7983243 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,3 +1,15 @@ +# +# Copyright 2024 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Build and Test on: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb73fa8c..86339018 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,15 @@ +# +# Copyright 2024 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Release on: diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index effdefa3..8cef57d2 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -1,3 +1,15 @@ +# +# Copyright 2024 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Update Versions on: diff --git a/.github/workflows/upstream-integration-test.yml b/.github/workflows/upstream-integration-test.yml index e1812a14..925b154f 100644 --- a/.github/workflows/upstream-integration-test.yml +++ b/.github/workflows/upstream-integration-test.yml @@ -1,3 +1,15 @@ +# +# Copyright 2024 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + # Action to execute upstream integration tests - Edge Network (Konductor) name: Integration Tests From a38f17e6612847d248567cc55619d18fd1ef2eb3 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:52:33 -0800 Subject: [PATCH 08/22] Apply prod config --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c7983243..7abbf53f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,7 +18,7 @@ on: jobs: build-and-test: name: " " - uses: timkimadobe/aepsdk-commons/.github/workflows/ios-build-and-test.yml@gha-ios-5.0.0 + uses: adobe/aepsdk-commons/.github/workflows/ios-build-and-test.yml@gha-ios-5.0.0 with: ios-device-names: '["iPhone 15"]' ios-versions: '["18.1"]' From 716936ba018872e6fabae62b8551fa1bb8b55bea Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:15:18 -0800 Subject: [PATCH 09/22] Trigger change --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5789aa2c..a3969114 100644 --- a/README.md +++ b/README.md @@ -150,3 +150,4 @@ This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for ## Security policy See the [SECURITY POLICY](SECURITY.md) for more details. + From 9d4d5be34873b7fca7496b396ea55deb2aa954c4 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:23:27 -0800 Subject: [PATCH 10/22] Remove @ from Makefile rule for integration test Rename build and test job Revert change to README --- .github/workflows/build-and-test.yml | 2 +- Makefile | 2 +- README.md | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7abbf53f..8e162522 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -17,7 +17,7 @@ on: jobs: build-and-test: - name: " " + name: "CI" uses: adobe/aepsdk-commons/.github/workflows/ios-build-and-test.yml@gha-ios-5.0.0 with: ios-device-names: '["iPhone 15"]' diff --git a/Makefile b/Makefile index a55c2f04..368d4b85 100644 --- a/Makefile +++ b/Makefile @@ -163,7 +163,7 @@ functional-test-tvos: # If MOBILE_PROPERTY_ID is not specified, test target will use its default value. .SILENT: test-integration-upstream # Silences Makefile's automatic echo of commands test-integration-upstream: pod-install; \ - @$(MAKE) clean-derived-data SCHEME=UpstreamIntegrationTests DESTINATION=$(IOS_DESTINATION) + $(MAKE) clean-derived-data SCHEME=UpstreamIntegrationTests DESTINATION=$(IOS_DESTINATION) if [ -z "$$EDGE_ENVIRONMENT" ]; then \ echo ''; \ echo '-------------------------- WARNING -------------------------------'; \ diff --git a/README.md b/README.md index a3969114..5789aa2c 100644 --- a/README.md +++ b/README.md @@ -150,4 +150,3 @@ This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for ## Security policy See the [SECURITY POLICY](SECURITY.md) for more details. - From 88a48d68c905bb8599ec9a6c179150679d7692c8 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:47:11 -0800 Subject: [PATCH 11/22] Increase timeout from 2 to 5 sec --- Tests/FunctionalTests/Edge+PublicAPITests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/FunctionalTests/Edge+PublicAPITests.swift b/Tests/FunctionalTests/Edge+PublicAPITests.swift index 2a81929a..11644ed6 100644 --- a/Tests/FunctionalTests/Edge+PublicAPITests.swift +++ b/Tests/FunctionalTests/Edge+PublicAPITests.swift @@ -18,7 +18,7 @@ import AEPTestUtils import XCTest class EdgePublicAPITests: TestBase { - private let TIMEOUT_SEC: TimeInterval = 2 + private let TIMEOUT_SEC: TimeInterval = 5 private let exEdgeInteractProdUrlLocHint = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR_OR2_LOC)! // swiftlint:disable:this force_unwrapping private let responseBody = "{\"test\": \"json\"}" From b78103bf40d869013664c8d4db59ff4d9fb72186 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:47:44 -0800 Subject: [PATCH 12/22] Fix double expectation for first event --- Tests/FunctionalTests/AEPEdgeFunctionalTests.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift index b818e3d6..8d84605d 100644 --- a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift +++ b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift @@ -792,10 +792,8 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { mockNetworkService.setMockResponse(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post, responseConnection: responseConnection) let experienceEvent = ExperienceEvent(xdm: ["testString": "xdm"], data: nil) - Edge.sendEvent(experienceEvent: experienceEvent) - // first network call, no stored data - mockNetworkService.setExpectationForNetworkRequest(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post, expectedCount: 1) + Edge.sendEvent(experienceEvent: experienceEvent) // Validate var resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) From 0d7e430c66b18ed70cb26075a367759bf3051c22 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:06:15 -0800 Subject: [PATCH 13/22] Add MobileCore resetSDK to teardown --- Tests/FunctionalTests/AEPEdgeFunctionalTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift index 8d84605d..b927c315 100644 --- a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift +++ b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift @@ -83,6 +83,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { super.tearDown() mockNetworkService.reset() + MobileCore.resetSDK() } func testUnregistered() { From 1443f22d3391d1a376231e9ca3233f1e0247abd8 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:28:54 -0800 Subject: [PATCH 14/22] Add reset test expectations to tear down and increase timeout --- Tests/FunctionalTests/AEPEdgeFunctionalTests.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift index b927c315..223b5638 100644 --- a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift +++ b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift @@ -22,7 +22,7 @@ import XCTest /// End-to-end testing for the AEPEdge public APIs class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 2 + private let TIMEOUT_SEC: TimeInterval = 10 private let LONGER_TIMEOUT_SEC: TimeInterval = 10 private let event1 = Event(name: "e1", type: "eventType", source: "eventSource", data: nil) private let event2 = Event(name: "e2", type: "eventType", source: "eventSource", data: nil) @@ -82,8 +82,10 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { override func tearDown() { super.tearDown() - mockNetworkService.reset() MobileCore.resetSDK() + + mockNetworkService.reset() + resetTestExpectations() } func testUnregistered() { From b4a9df3732bb7f0551740df139cada2c824c6ce6 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:29:05 -0800 Subject: [PATCH 15/22] Increase timeout duration to 10 sec default --- .../CompletionHandlerFunctionalTests.swift | 2 +- Tests/FunctionalTests/Edge+ConsentTests.swift | 2 +- Tests/FunctionalTests/Edge+PublicAPITests.swift | 2 +- .../EdgeDatastreamConfigOverrideTests.swift | 8 ++++---- .../FunctionalTests/EdgeQueuedEntityFunctionalTests.swift | 2 +- Tests/FunctionalTests/IdentityStateFunctionalTests.swift | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift b/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift index fcf3c68b..1404653b 100644 --- a/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift +++ b/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift @@ -20,7 +20,7 @@ import XCTest /// End-to-end testing for the AEPEdge public APIs with completion handlers class CompletionHandlerFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 2 + private let TIMEOUT_SEC: TimeInterval = 10 private let event1 = Event(name: "e1", type: "eventType", source: "eventSource", data: nil) private let event2 = Event(name: "e2", type: "eventType", source: "eventSource", data: nil) private let responseBody = "{\"test\": \"json\"}" diff --git a/Tests/FunctionalTests/Edge+ConsentTests.swift b/Tests/FunctionalTests/Edge+ConsentTests.swift index 8b1faf35..1edcb008 100644 --- a/Tests/FunctionalTests/Edge+ConsentTests.swift +++ b/Tests/FunctionalTests/Edge+ConsentTests.swift @@ -20,7 +20,7 @@ import Foundation import XCTest class EdgeConsentTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 2 + private let TIMEOUT_SEC: TimeInterval = 10 private let EVENTS_COUNT: Int32 = 5 private let experienceEvent = ExperienceEvent(xdm: ["test": "xdm"]) private let responseBody = "\u{0000}{" + diff --git a/Tests/FunctionalTests/Edge+PublicAPITests.swift b/Tests/FunctionalTests/Edge+PublicAPITests.swift index 11644ed6..961f6554 100644 --- a/Tests/FunctionalTests/Edge+PublicAPITests.swift +++ b/Tests/FunctionalTests/Edge+PublicAPITests.swift @@ -18,7 +18,7 @@ import AEPTestUtils import XCTest class EdgePublicAPITests: TestBase { - private let TIMEOUT_SEC: TimeInterval = 5 + private let TIMEOUT_SEC: TimeInterval = 10 private let exEdgeInteractProdUrlLocHint = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR_OR2_LOC)! // swiftlint:disable:this force_unwrapping private let responseBody = "{\"test\": \"json\"}" diff --git a/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift b/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift index a612b4c4..8912b01e 100644 --- a/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift +++ b/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift @@ -21,7 +21,7 @@ import XCTest // swiftlint:disable type_body_length /// Functional tests for the sendEvent API with datastreamIdOverride and datastreamConfigOverride features class AEPEdgeDatastreamOverrideTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 2 + private let TIMEOUT_SEC: TimeInterval = 10 private let exEdgeInteractProdUrl = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)! // swiftlint:disable:this force_unwrapping private let responseBody = "{\"test\": \"json\"}" #if os(iOS) @@ -111,7 +111,7 @@ class AEPEdgeDatastreamOverrideTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) // Validate URL @@ -185,7 +185,7 @@ class AEPEdgeDatastreamOverrideTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) // Validate URL @@ -235,7 +235,7 @@ class AEPEdgeDatastreamOverrideTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) // Valdiate URL diff --git a/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift b/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift index 664f11d9..b47cd361 100644 --- a/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift +++ b/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift @@ -19,7 +19,7 @@ import Foundation import XCTest class EdgeQueuedEntityFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 2 + private let TIMEOUT_SEC: TimeInterval = 10 private let LONGER_TIMEOUT_SEC: TimeInterval = 10 private let exEdgeInteractProdUrl = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)! // swiftlint:disable:this force_unwrapping diff --git a/Tests/FunctionalTests/IdentityStateFunctionalTests.swift b/Tests/FunctionalTests/IdentityStateFunctionalTests.swift index f1f1e5af..78c2dc3b 100644 --- a/Tests/FunctionalTests/IdentityStateFunctionalTests.swift +++ b/Tests/FunctionalTests/IdentityStateFunctionalTests.swift @@ -18,7 +18,7 @@ import XCTest /// Functional test suite for tests which require no Identity shared state at startup to simulate a missing or pending state. class IdentityStateFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 2 + private let TIMEOUT_SEC: TimeInterval = 10 private let exEdgeInteractUrl = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)! // swiftlint:disable:this force_unwrapping private let mockNetworkService: MockNetworkService = MockNetworkService() From d5e5fb3fd15b78e784dc48840b2d7221996483c3 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:39:49 -0800 Subject: [PATCH 16/22] Add timeout to all network request assertions --- .../AEPEdgeFunctionalTests.swift | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift index 223b5638..88d4ecd1 100644 --- a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift +++ b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift @@ -319,7 +319,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) // Note that `recordSeparator` is set in the format required by the JSON spec to be properly decoded, @@ -385,7 +385,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) let expectedJSON = createExpectedPayload( @@ -452,7 +452,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) let expectedJSON = createExpectedPayload( @@ -564,7 +564,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) let expectedJSON = #""" @@ -854,7 +854,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: ExperienceEvent(xdm: ["eventType": "personalizationEvent", "test": "xdm"], data: nil)) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) assertExpectedEvents(ignoreUnexpectedEvents: true) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) @@ -911,7 +911,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: ExperienceEvent(xdm: ["eventType": "personalizationEvent", "test": "xdm"], data: nil)) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) assertExpectedEvents(ignoreUnexpectedEvents: true) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) @@ -957,7 +957,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { "testArray": ["arrayElem1", 2, true], "testDictionary": ["key": "val"]]) Edge.sendEvent(experienceEvent: experienceEvent) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) resetTestExpectations() mockNetworkService.reset() @@ -998,7 +998,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) Edge.sendEvent(experienceEvent: experienceEvent) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) resetTestExpectations() mockNetworkService.reset() @@ -1038,7 +1038,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { let experienceEvent = ExperienceEvent(xdm: ["testString": "xdm"], data: nil) Edge.sendEvent(experienceEvent: experienceEvent) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) assertExpectedEvents(ignoreUnexpectedEvents: false) let resultEvents = getDispatchedEventsWith(type: TestConstants.EventType.EDGE, @@ -1119,7 +1119,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { let experienceEvent = ExperienceEvent(xdm: ["testString": "xdm"], data: nil) Edge.sendEvent(experienceEvent: experienceEvent) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) assertExpectedEvents(ignoreUnexpectedEvents: false) let resultEvents = getDispatchedEventsWith(type: TestConstants.EventType.EDGE, @@ -1163,7 +1163,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { let experienceEvent = ExperienceEvent(xdm: ["testString": "xdm"], data: nil) Edge.sendEvent(experienceEvent: experienceEvent) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) assertExpectedEvents(ignoreUnexpectedEvents: false) let resultEvents = getDispatchedEventsWith(type: TestConstants.EventType.EDGE, @@ -1198,7 +1198,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { "testArray": ["arrayElem1", 2, true], "testDictionary": ["key": "val"]]) Edge.sendEvent(experienceEvent: experienceEvent) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) resetTestExpectations() mockNetworkService.reset() @@ -1236,7 +1236,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { let experienceEvent = ExperienceEvent(xdm: ["testString": "xdm"], data: nil) Edge.sendEvent(experienceEvent: experienceEvent) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) assertExpectedEvents(ignoreUnexpectedEvents: false) let resultEvents = getDispatchedEventsWith(type: TestConstants.EventType.EDGE, @@ -1268,7 +1268,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) let requestUrl = resultNetworkRequests[0].url @@ -1294,7 +1294,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) let requestUrl = resultNetworkRequests[0].url @@ -1320,7 +1320,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) let requestUrl = resultNetworkRequests[0].url @@ -1346,7 +1346,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PRE_PROD_URL_STR, httpMethod: HttpMethod.post) let requestUrl = resultNetworkRequests[0].url @@ -1372,7 +1372,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_INTEGRATION_URL_STR, httpMethod: HttpMethod.post) let requestUrl = resultNetworkRequests[0].url @@ -1399,7 +1399,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) var resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) XCTAssertEqual(1, resultNetworkRequests.count) XCTAssertTrue(resultNetworkRequests[0].url.absoluteURL.absoluteString.hasPrefix(TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)) @@ -1432,7 +1432,7 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: experienceEvent) // verify - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) XCTAssertEqual(2, resultNetworkRequests.count) XCTAssertTrue(resultNetworkRequests[0].url.absoluteURL.absoluteString.hasPrefix(TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)) From 84cbcc10c2c2359ddba2918367ed8e120cf4b131 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:56:26 -0800 Subject: [PATCH 17/22] Update order of files --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86339018..17a60338 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,5 +41,5 @@ jobs: tag: ${{ github.event.inputs.tag }} create-github-release: ${{ github.event.inputs.create-github-release == 'true' && 'AEPEdge' || '' }} pod-publish-extensions: ${{ github.event.inputs.pod-publish-extensions == 'true' && 'AEPEdge' || '' }} - version-validation-paths: AEPEdge.podspec, Sources/EdgeConstants.swift, AEPEdge.xcodeproj/project.pbxproj + version-validation-paths: AEPEdge.podspec, AEPEdge.xcodeproj/project.pbxproj, Sources/EdgeConstants.swift, secrets: inherit \ No newline at end of file From a17b0ab5b8d7d6083c107754897fa1f56ebd1d41 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:56:48 -0800 Subject: [PATCH 18/22] Rename upstream integration test job to align with naming convention style --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 368d4b85..3cc71765 100644 --- a/Makefile +++ b/Makefile @@ -159,10 +159,10 @@ functional-test-tvos: # Runs the Edge Network (Konductor) integration tests after installing pod dependencies # Usage: -# make test-integration-upstream MOBILE_PROPERTY_ID= EDGE_LOCATION_HINT= +# make upstream-integration-test-ios MOBILE_PROPERTY_ID= EDGE_LOCATION_HINT= # If MOBILE_PROPERTY_ID is not specified, test target will use its default value. -.SILENT: test-integration-upstream # Silences Makefile's automatic echo of commands -test-integration-upstream: pod-install; \ +.SILENT: upstream-integration-test-ios # Silences Makefile's automatic echo of commands +upstream-integration-test-ios: pod-install; \ $(MAKE) clean-derived-data SCHEME=UpstreamIntegrationTests DESTINATION=$(IOS_DESTINATION) if [ -z "$$EDGE_ENVIRONMENT" ]; then \ echo ''; \ From ecff2d00c8dd6e71dc5c56e1ee85614c6186a5cb Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:22:10 -0800 Subject: [PATCH 19/22] Create integration test rule name that aligns with reusable workflow --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 3cc71765..2fa0e841 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,8 @@ functional-test-tvos: @$(MAKE) clean-derived-data SCHEME=FunctionalTests DESTINATION=$(TVOS_DESTINATION) xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme "FunctionalTests" -destination $(TVOS_DESTINATION) -enableCodeCoverage YES ADB_SKIP_LINT=YES +integration-test-ios: upstream-integration-test-ios + # Runs the Edge Network (Konductor) integration tests after installing pod dependencies # Usage: # make upstream-integration-test-ios MOBILE_PROPERTY_ID= EDGE_LOCATION_HINT= From 6244c4af9b6a2fc61983dc924e07c7cf95616389 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:13:26 -0800 Subject: [PATCH 20/22] Use codecov flag based on new default --- .github/workflows/build-and-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 8e162522..90b58b4e 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -30,4 +30,5 @@ jobs: run-test-tvos-unit: true run-test-tvos-functional: true run-build-xcframework-and-app: true + enable-codecov: true secrets: inherit \ No newline at end of file From 6cf2f828bbe4a3940e844f28293c9f8f4676620b Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:00:15 -0800 Subject: [PATCH 21/22] Create new functional test constants and route functional test usage to new default --- AEPEdge.xcodeproj/project.pbxproj | 4 ++++ .../AEPEdgeFunctionalTests.swift | 12 ++++++----- .../CompletionHandlerFunctionalTests.swift | 2 +- Tests/FunctionalTests/Edge+ConsentTests.swift | 2 +- .../FunctionalTests/Edge+PublicAPITests.swift | 2 +- .../EdgeDatastreamConfigOverrideTests.swift | 2 +- .../EdgeQueuedEntityFunctionalTests.swift | 7 +++---- .../IdentityStateFunctionalTests.swift | 2 +- .../util/FunctionalTestConstants.swift | 21 +++++++++++++++++++ 9 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 Tests/FunctionalTests/util/FunctionalTestConstants.swift diff --git a/AEPEdge.xcodeproj/project.pbxproj b/AEPEdge.xcodeproj/project.pbxproj index 404f5d66..5fd61de7 100644 --- a/AEPEdge.xcodeproj/project.pbxproj +++ b/AEPEdge.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ 2EDD05CA286EAA7000229CB2 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D4D5B5852432977F00CAB6E4 /* Preview Assets.xcassets */; }; 2EDD05CB286EAA7000229CB2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D4D5B5822432977F00CAB6E4 /* Assets.xcassets */; }; 423B5033D43ADB49049383FB /* Pods_FunctionalTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B13510405D14B13EFD1B58A /* Pods_FunctionalTests.framework */; }; + 4C089BC52CF01AA900CB500C /* FunctionalTestConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C089BC42CF01AA900CB500C /* FunctionalTestConstants.swift */; }; 4CBEE5D829D637170084BC50 /* AEPEdge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D444995F2519506B0093B364 /* AEPEdge.framework */; }; 4CBEE5E629D637E90084BC50 /* UpstreamIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBEE5E229D637E90084BC50 /* UpstreamIntegrationTests.swift */; }; 4CBEE5FD29FB47270084BC50 /* TestConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A473C52485938D00D31710 /* TestConstants.swift */; }; @@ -231,6 +232,7 @@ 2ECFB7512AB391F400653128 /* EdgeDatastreamConfigOverrideTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EdgeDatastreamConfigOverrideTests.swift; sourceTree = ""; }; 2EDD05D2286EAA7000229CB2 /* TestApptvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestApptvOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; 316EF062B0B622235F6BB384 /* Pods_TestAppiOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TestAppiOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4C089BC42CF01AA900CB500C /* FunctionalTestConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FunctionalTestConstants.swift; sourceTree = ""; }; 4CBEE5E029D637170084BC50 /* UpstreamIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UpstreamIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 4CBEE5E229D637E90084BC50 /* UpstreamIntegrationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UpstreamIntegrationTests.swift; sourceTree = ""; }; 4CBEE60D2A156FB10084BC50 /* CompletionHandlerFunctionalTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompletionHandlerFunctionalTests.swift; sourceTree = ""; }; @@ -463,6 +465,7 @@ isa = PBXGroup; children = ( BF024B7824C6238C002131E9 /* FakeIdentityExtension.swift */, + 4C089BC42CF01AA900CB500C /* FunctionalTestConstants.swift */, BF0C09472465E42100892B5D /* TestableEdge.swift */, D48CBD2124A17EEA00A24BD8 /* TestXDMSchema.swift */, ); @@ -1348,6 +1351,7 @@ BF024B7924C6238C002131E9 /* FakeIdentityExtension.swift in Sources */, 4CBEE61F2A15764B0084BC50 /* IdentityStateFunctionalTests.swift in Sources */, 4CBEE61B2A1572E50084BC50 /* Edge+PublicAPITests.swift in Sources */, + 4C089BC52CF01AA900CB500C /* FunctionalTestConstants.swift in Sources */, 4CBEE6192A1571DC0084BC50 /* Edge+ConsentTests.swift in Sources */, D48CBD2224A17EEA00A24BD8 /* TestXDMSchema.swift in Sources */, BFDF25AB2BD02E58002114B6 /* EdgeQueuedEntityFunctionalTests.swift in Sources */, diff --git a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift index 88d4ecd1..52949d32 100644 --- a/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift +++ b/Tests/FunctionalTests/AEPEdgeFunctionalTests.swift @@ -22,8 +22,7 @@ import XCTest /// End-to-end testing for the AEPEdge public APIs class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 10 - private let LONGER_TIMEOUT_SEC: TimeInterval = 10 + private let TIMEOUT_SEC: TimeInterval = FunctionalTestConstants.Defaults.TIMEOUT_SEC private let event1 = Event(name: "e1", type: "eventType", source: "eventSource", data: nil) private let event2 = Event(name: "e2", type: "eventType", source: "eventSource", data: nil) private let exEdgeInteractProdUrl = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)! // swiftlint:disable:this force_unwrapping @@ -972,7 +971,8 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { mockNetworkService.setMockResponse(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post, responseConnection: httpConnection) // Default retry time period is 5 sec - provide extra timeout buffer - mockNetworkService.assertAllNetworkRequestExpectations(timeout: LONGER_TIMEOUT_SEC) + // Make sure this timeout is at least double the retry time period + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) } func testSendEvent_withXDMData_sendsExEdgeNetworkRequest_afterPersistingMultipleHits() { @@ -1013,7 +1013,8 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { mockNetworkService.setMockResponse(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post, responseConnection: httpConnection) // Default retry time period is 5 sec - provide extra timeout buffer - mockNetworkService.assertAllNetworkRequestExpectations(timeout: LONGER_TIMEOUT_SEC) + // Make sure this timeout is at least double the retry time period + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) } func testSendEvent_multiStatusResponse_dispatchesEvents() { @@ -1213,7 +1214,8 @@ class AEPEdgeFunctionalTests: TestBase, AnyCodableAsserts { mockNetworkService.setMockResponse(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post, responseConnection: httpConnection) // Default retry time period is 5 sec - provide extra timeout buffer - mockNetworkService.assertAllNetworkRequestExpectations(timeout: LONGER_TIMEOUT_SEC) + // Make sure this timeout is at least double the retry time period + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) } func testSendEvent_unrecoverableNetworkTransportError_noRetry() { diff --git a/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift b/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift index 1404653b..50034101 100644 --- a/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift +++ b/Tests/FunctionalTests/CompletionHandlerFunctionalTests.swift @@ -20,7 +20,7 @@ import XCTest /// End-to-end testing for the AEPEdge public APIs with completion handlers class CompletionHandlerFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 10 + private let TIMEOUT_SEC: TimeInterval = FunctionalTestConstants.Defaults.TIMEOUT_SEC private let event1 = Event(name: "e1", type: "eventType", source: "eventSource", data: nil) private let event2 = Event(name: "e2", type: "eventType", source: "eventSource", data: nil) private let responseBody = "{\"test\": \"json\"}" diff --git a/Tests/FunctionalTests/Edge+ConsentTests.swift b/Tests/FunctionalTests/Edge+ConsentTests.swift index 1edcb008..75c22ddf 100644 --- a/Tests/FunctionalTests/Edge+ConsentTests.swift +++ b/Tests/FunctionalTests/Edge+ConsentTests.swift @@ -20,7 +20,7 @@ import Foundation import XCTest class EdgeConsentTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 10 + private let TIMEOUT_SEC: TimeInterval = FunctionalTestConstants.Defaults.TIMEOUT_SEC private let EVENTS_COUNT: Int32 = 5 private let experienceEvent = ExperienceEvent(xdm: ["test": "xdm"]) private let responseBody = "\u{0000}{" + diff --git a/Tests/FunctionalTests/Edge+PublicAPITests.swift b/Tests/FunctionalTests/Edge+PublicAPITests.swift index 961f6554..0743d368 100644 --- a/Tests/FunctionalTests/Edge+PublicAPITests.swift +++ b/Tests/FunctionalTests/Edge+PublicAPITests.swift @@ -18,7 +18,7 @@ import AEPTestUtils import XCTest class EdgePublicAPITests: TestBase { - private let TIMEOUT_SEC: TimeInterval = 10 + private let TIMEOUT_SEC: TimeInterval = FunctionalTestConstants.Defaults.TIMEOUT_SEC private let exEdgeInteractProdUrlLocHint = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR_OR2_LOC)! // swiftlint:disable:this force_unwrapping private let responseBody = "{\"test\": \"json\"}" diff --git a/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift b/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift index 8912b01e..7b967470 100644 --- a/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift +++ b/Tests/FunctionalTests/EdgeDatastreamConfigOverrideTests.swift @@ -21,7 +21,7 @@ import XCTest // swiftlint:disable type_body_length /// Functional tests for the sendEvent API with datastreamIdOverride and datastreamConfigOverride features class AEPEdgeDatastreamOverrideTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 10 + private let TIMEOUT_SEC: TimeInterval = FunctionalTestConstants.Defaults.TIMEOUT_SEC private let exEdgeInteractProdUrl = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)! // swiftlint:disable:this force_unwrapping private let responseBody = "{\"test\": \"json\"}" #if os(iOS) diff --git a/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift b/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift index b47cd361..47ea05fe 100644 --- a/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift +++ b/Tests/FunctionalTests/EdgeQueuedEntityFunctionalTests.swift @@ -19,8 +19,7 @@ import Foundation import XCTest class EdgeQueuedEntityFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 10 - private let LONGER_TIMEOUT_SEC: TimeInterval = 10 + private let TIMEOUT_SEC: TimeInterval = FunctionalTestConstants.Defaults.TIMEOUT_SEC private let exEdgeInteractProdUrl = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)! // swiftlint:disable:this force_unwrapping private let mockNetworkService: MockNetworkService = MockNetworkService() @@ -69,7 +68,7 @@ class EdgeQueuedEntityFunctionalTests: TestBase, AnyCodableAsserts { startMobileSDK() // Wait for expected network requests - mockNetworkService.assertAllNetworkRequestExpectations(timeout: LONGER_TIMEOUT_SEC) + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) // Validate result - hit uses configId from Configuration shared state @@ -109,7 +108,7 @@ class EdgeQueuedEntityFunctionalTests: TestBase, AnyCodableAsserts { startMobileSDK() // Wait for expected network requests - mockNetworkService.assertAllNetworkRequestExpectations(timeout: LONGER_TIMEOUT_SEC) + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) let resultNetworkRequests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) // Validate result diff --git a/Tests/FunctionalTests/IdentityStateFunctionalTests.swift b/Tests/FunctionalTests/IdentityStateFunctionalTests.swift index 78c2dc3b..fba9c7a2 100644 --- a/Tests/FunctionalTests/IdentityStateFunctionalTests.swift +++ b/Tests/FunctionalTests/IdentityStateFunctionalTests.swift @@ -18,7 +18,7 @@ import XCTest /// Functional test suite for tests which require no Identity shared state at startup to simulate a missing or pending state. class IdentityStateFunctionalTests: TestBase, AnyCodableAsserts { - private let TIMEOUT_SEC: TimeInterval = 10 + private let TIMEOUT_SEC: TimeInterval = FunctionalTestConstants.Defaults.TIMEOUT_SEC private let exEdgeInteractUrl = URL(string: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR)! // swiftlint:disable:this force_unwrapping private let mockNetworkService: MockNetworkService = MockNetworkService() diff --git a/Tests/FunctionalTests/util/FunctionalTestConstants.swift b/Tests/FunctionalTests/util/FunctionalTestConstants.swift new file mode 100644 index 00000000..43929b67 --- /dev/null +++ b/Tests/FunctionalTests/util/FunctionalTestConstants.swift @@ -0,0 +1,21 @@ +// +// Copyright 2024 Adobe. All rights reserved. +// This file is licensed to you under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. You may obtain a copy +// of the License at http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under +// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +// OF ANY KIND, either express or implied. See the License for the specific language +// governing permissions and limitations under the License. +// + + +import Foundation + +enum FunctionalTestConstants { + enum Defaults { + // Default timeout for assertions. Set to a high value to accommodate slower CI runners. + static let TIMEOUT_SEC: TimeInterval = 10 + } +} From 9b411f2c0687518b2a39396a38e58127277856a6 Mon Sep 17 00:00:00 2001 From: timkimadobe <95260439+timkimadobe@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:08:57 -0800 Subject: [PATCH 22/22] Add default timeout to network request assertions --- Tests/FunctionalTests/IdentityStateFunctionalTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/FunctionalTests/IdentityStateFunctionalTests.swift b/Tests/FunctionalTests/IdentityStateFunctionalTests.swift index fba9c7a2..e1c419c8 100644 --- a/Tests/FunctionalTests/IdentityStateFunctionalTests.swift +++ b/Tests/FunctionalTests/IdentityStateFunctionalTests.swift @@ -104,7 +104,7 @@ class IdentityStateFunctionalTests: TestBase, AnyCodableAsserts { } let identityMap = try? JSONSerialization.jsonObject(with: identityMapData, options: []) as? [String: Any] FakeIdentityExtension.setXDMSharedState(state: identityMap!) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) requests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post) XCTAssertEqual(1, requests.count) @@ -162,7 +162,7 @@ class IdentityStateFunctionalTests: TestBase, AnyCodableAsserts { Edge.sendEvent(experienceEvent: ExperienceEvent(xdm: ["test1": "xdm"], data: nil)) - mockNetworkService.assertAllNetworkRequestExpectations() + mockNetworkService.assertAllNetworkRequestExpectations(timeout: TIMEOUT_SEC) // Assert network request does not contain an ECID let requests = mockNetworkService.getNetworkRequestsWith(url: TestConstants.EX_EDGE_INTERACT_PROD_URL_STR, httpMethod: HttpMethod.post)