diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 638a681b12..d6de96ba0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,17 @@ jobs: AWS_KVS_LOG_LEVEL: 2 LDFLAGS: -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib CPATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Build repository run: | mkdir build && cd build @@ -48,9 +56,17 @@ jobs: CC: gcc CXX: g++ AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Build repository run: | mkdir build && cd build @@ -66,9 +82,17 @@ jobs: AWS_KVS_LOG_LEVEL: 2 LDFLAGS: -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib CPATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Build repository run: | mkdir build && cd build @@ -82,9 +106,17 @@ jobs: runs-on: ubuntu-20.04 env: AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Build repository run: | sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' @@ -108,9 +140,17 @@ jobs: CC: clang CXX: clang++ AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Install dependencies run: | sudo apt clean && sudo apt update @@ -134,9 +174,17 @@ jobs: CC: clang CXX: clang++ AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Install dependencies run: | sudo apt clean && sudo apt update @@ -177,13 +225,21 @@ jobs: thread-sanitizer: runs-on: ubuntu-20.04 env: - TSAN_OPTIONS: halt_on_error=1:suppressions=../tst/suppressions/TSAN.supp + TSAN_OPTIONS: second_deadlock_stack=1:halt_on_error=1:suppressions=../tst/suppressions/TSAN.supp CC: clang CXX: clang++ AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Install dependencies run: | sudo apt clean && sudo apt update @@ -204,9 +260,17 @@ jobs: env: AWS_KVS_LOG_LEVEL: 2 CC: gcc-4.4 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Install deps run: | sudo apt clean && sudo apt update @@ -235,6 +299,9 @@ jobs: CC: gcc CXX: g++ AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 @@ -252,9 +319,17 @@ jobs: runs-on: ubuntu-20.04 env: AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Install deps run: | sudo apt clean && sudo apt update @@ -281,9 +356,17 @@ jobs: CC: clang CXX: clang++ AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Install dependencies run: | sudo apt clean && sudo apt update @@ -311,10 +394,9 @@ jobs: - name: Clone repository uses: actions/checkout@v3 - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1-node16 + uses: aws-actions/configure-aws-credentials@v2 with: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} - role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }} aws-region: ${{ secrets.AWS_REGION }} - name: Build repository run: | @@ -328,9 +410,17 @@ jobs: runs-on: ubuntu-20.04 env: AWS_KVS_LOG_LEVEL: 2 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Build repository run: | # TODO: Remove the following line. This is only a workaround for enabling IPv6, https://github.com/travis-ci/travis-ci/issues/8891. @@ -346,9 +436,17 @@ jobs: runs-on: windows-2022 env: AWS_KVS_LOG_LEVEL: 1 + permissions: + id-token: write + contents: read steps: - name: Clone repository uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Move cloned repo shell: powershell run: | @@ -358,7 +456,7 @@ jobs: shell: powershell run: | choco install gstreamer --version=1.16.2 - choco install gstreamer-devel --version=1.16.2 + choco install gstreamer-devel --version=1.16.2 curl.exe -o C:\tools\pthreads-w32-2-9-1-release.zip ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip mkdir C:\tools\pthreads-w32-2-9-1-release\ Expand-Archive -Path C:\tools\pthreads-w32-2-9-1-release.zip -DestinationPath C:\tools\pthreads-w32-2-9-1-release @@ -467,4 +565,4 @@ jobs: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' mkdir build && cd build cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi - make + make \ No newline at end of file diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index a06ec75d38..368292b147 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -11,11 +11,19 @@ on: jobs: linux-gcc-codecov: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Fetch uses: actions/checkout@v3 with: fetch-depth: 2 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} + aws-region: ${{ secrets.AWS_REGION }} - name: Run code coverage run: | mkdir build diff --git a/.github/workflows/pr-desc-lint.yml b/.github/workflows/pr-desc-lint.yml index d9ff312b1d..0fe1117916 100644 --- a/.github/workflows/pr-desc-lint.yml +++ b/.github/workflows/pr-desc-lint.yml @@ -27,14 +27,14 @@ jobs: error_occurred=0 # Define minimum character count for each section MIN_CHARS=25 - + # Extract contents # Extract contents what_changed=$(echo "$pr_description" | sed -n -e '/\*What was changed?\*/,/\*/p' | sed '$d' | sed '1d') why_changed=$(echo "$pr_description" | sed -n -e '/\*Why was it changed?\*/,/\*/p' | sed '$d' | sed '1d') how_changed=$(echo "$pr_description" | sed -n -e '/\*How was it changed?\*/,/\*/p' | sed '$d' | sed '1d') testing_done=$(echo "$pr_description" | sed -n -e '/\*What testing was done for the changes?\*/,/\*/p' | sed '$d' | sed '1d') - + if [[ ${#what_changed} -lt $MIN_CHARS ]]; then echo "PR description for what changed section is either missing or too short." error_occurred=1 diff --git a/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt b/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt index 1c3ff91c1f..51cf12ba3e 100644 --- a/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt +++ b/CMake/Dependencies/libkvsCommonLws-CMakeLists.txt @@ -6,7 +6,7 @@ include(ExternalProject) ExternalProject_Add(libkvsCommonLws-download GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git - GIT_TAG daf742a0a53f72341e5b2df75a05ebe6d2557811 + GIT_TAG ab3b6331594dfbd0a59686dfb8dc4938bc86da1a PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX} diff --git a/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h b/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h index 973b59984d..0df3022f5d 100644 --- a/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h +++ b/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h @@ -631,11 +631,17 @@ extern "C" { */ #define SIGNALING_CONNECT_TIMEOUT (5 * HUNDREDS_OF_NANOS_IN_A_SECOND) +#ifdef _WIN32 +/** + * Default timeout for sending data + */ +#define SIGNALING_SEND_TIMEOUT (15 * HUNDREDS_OF_NANOS_IN_A_SECOND) +#else /** * Default timeout for sending data */ #define SIGNALING_SEND_TIMEOUT (5 * HUNDREDS_OF_NANOS_IN_A_SECOND) - +#endif /** * Default timeout for deleting a channel */ diff --git a/src/source/Ice/SocketConnection.c b/src/source/Ice/SocketConnection.c index 4b1b0ec7c8..7d3fb02719 100644 --- a/src/source/Ice/SocketConnection.c +++ b/src/source/Ice/SocketConnection.c @@ -66,7 +66,12 @@ STATUS freeSocketConnection(PSocketConnection* ppSocketConnection) CHK(ppSocketConnection != NULL, STATUS_NULL_ARG); pSocketConnection = *ppSocketConnection; CHK(pSocketConnection != NULL, retStatus); + + // connectionClosed is accessed and modified when checking if socket connection is closed + // Hence the modification needs to be protected + MUTEX_LOCK(pSocketConnection->lock); ATOMIC_STORE_BOOL(&pSocketConnection->connectionClosed, TRUE); + MUTEX_UNLOCK(pSocketConnection->lock); // Await for the socket connection to be released shutdownTimeout = GETTIME() + KVS_ICE_TURN_CONNECTION_SHUTDOWN_TIMEOUT; diff --git a/src/source/Ice/TurnConnection.c b/src/source/Ice/TurnConnection.c index 86a75ed7b1..460211700e 100644 --- a/src/source/Ice/TurnConnection.c +++ b/src/source/Ice/TurnConnection.c @@ -90,11 +90,11 @@ STATUS freeTurnConnection(PTurnConnection* ppTurnConnection) pTurnConnection = *ppTurnConnection; + // Ensure we are not freeing everything without cancelling the timer timerCallbackId = ATOMIC_EXCHANGE(&pTurnConnection->timerCallbackId, MAX_UINT32); if (timerCallbackId != MAX_UINT32) { CHK_LOG_ERR(timerQueueCancelTimer(pTurnConnection->timerQueueHandle, (UINT32) timerCallbackId, (UINT64) pTurnConnection)); } - // shutdown control channel if (pTurnConnection->pControlChannel) { CHK_LOG_ERR(connectionListenerRemoveConnection(pTurnConnection->pConnectionListener, pTurnConnection->pControlChannel)); @@ -1076,7 +1076,9 @@ STATUS turnConnectionStepState(PTurnConnection pTurnConnection) } CHK_STATUS(turnConnectionFreePreAllocatedPackets(pTurnConnection)); - CHK_STATUS(socketConnectionClosed(pTurnConnection->pControlChannel)); + if (pTurnConnection != NULL) { + CHK_STATUS(socketConnectionClosed(pTurnConnection->pControlChannel)); + } pTurnConnection->state = STATUS_SUCCEEDED(pTurnConnection->errorStatus) ? TURN_STATE_NEW : TURN_STATE_FAILED; ATOMIC_STORE_BOOL(&pTurnConnection->shutdownComplete, TRUE); } diff --git a/tst/IceFunctionalityTest.cpp b/tst/IceFunctionalityTest.cpp index 8e51c11aa2..6ab40aa894 100644 --- a/tst/IceFunctionalityTest.cpp +++ b/tst/IceFunctionalityTest.cpp @@ -640,9 +640,7 @@ TEST_F(IceFunctionalityTest, IceAgentPruneUnconnectedIceCandidatePairUnitTest) TEST_F(IceFunctionalityTest, IceAgentCandidateGatheringTest) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); typedef struct { std::vector list; diff --git a/tst/PeerConnectionFunctionalityTest.cpp b/tst/PeerConnectionFunctionalityTest.cpp index 5a5e3ed3d5..35d4a3cda0 100644 --- a/tst/PeerConnectionFunctionalityTest.cpp +++ b/tst/PeerConnectionFunctionalityTest.cpp @@ -189,9 +189,7 @@ TEST_F(PeerConnectionFunctionalityTest, connectTwoPeersWithPresetCerts) // Assert that two PeerConnections with forced TURN can connect to each other and go to connected TEST_F(PeerConnectionFunctionalityTest, connectTwoPeersForcedTURN) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); RtcConfiguration configuration; PRtcPeerConnection offerPc = NULL, answerPc = NULL; @@ -218,9 +216,7 @@ TEST_F(PeerConnectionFunctionalityTest, connectTwoPeersForcedTURN) TEST_F(PeerConnectionFunctionalityTest, sendDataWithClosedSocketConnectionWithHostAndStun) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); RtcMediaStreamTrack offerVideoTrack; PRtcRtpTransceiver offerVideoTransceiver; @@ -281,9 +277,7 @@ TEST_F(PeerConnectionFunctionalityTest, sendDataWithClosedSocketConnectionWithHo TEST_F(PeerConnectionFunctionalityTest, sendDataWithClosedSocketConnectionWithForcedTurn) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); RtcMediaStreamTrack offerVideoTrack; PRtcRtpTransceiver offerVideoTransceiver; @@ -349,9 +343,7 @@ TEST_F(PeerConnectionFunctionalityTest, sendDataWithClosedSocketConnectionWithFo TEST_F(PeerConnectionFunctionalityTest, shutdownTurnDueToP2PFoundBeforeTurnEstablished) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); RtcConfiguration configuration; PRtcPeerConnection offerPc = NULL, answerPc = NULL; @@ -410,9 +402,7 @@ TEST_F(PeerConnectionFunctionalityTest, shutdownTurnDueToP2PFoundBeforeTurnEstab TEST_F(PeerConnectionFunctionalityTest, shutdownTurnDueToP2PFoundAfterTurnEstablished) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); RtcConfiguration configuration; PRtcPeerConnection offerPc = NULL, answerPc = NULL; @@ -541,10 +531,7 @@ TEST_F(PeerConnectionFunctionalityTest, connectTwoPeersWithHostAndStun) // Assert that two PeerConnections can connect and then terminate one of them, the other one will eventually report disconnection TEST_F(PeerConnectionFunctionalityTest, connectTwoPeersThenDisconnectTest) { - if (!mAccessKeyIdSet) { - return; - } - + ASSERT_EQ(TRUE, mAccessKeyIdSet); RtcConfiguration configuration; PRtcPeerConnection offerPc = NULL, answerPc = NULL; UINT32 i; @@ -783,9 +770,7 @@ TEST_F(PeerConnectionFunctionalityTest, exchangeMedia) // Same test as exchangeMedia, but assert that if one side is RSA DTLS and Key Extraction works TEST_F(PeerConnectionFunctionalityTest, exchangeMediaRSA) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); auto const frameBufferSize = 200000; @@ -869,9 +854,7 @@ TEST_F(PeerConnectionFunctionalityTest, iceRestartTestForcedTurn) RtcConfiguration configuration; PRtcPeerConnection offerPc = NULL, answerPc = NULL; - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); MEMSET(&configuration, 0x00, SIZEOF(RtcConfiguration)); configuration.iceTransportPolicy = ICE_TRANSPORT_POLICY_RELAY; @@ -905,9 +888,7 @@ TEST_F(PeerConnectionFunctionalityTest, peerConnectionOfferCloseConnection) RtcConfiguration configuration; PRtcPeerConnection offerPc = NULL, answerPc = NULL; - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); MEMSET(&configuration, 0x00, SIZEOF(RtcConfiguration)); @@ -934,10 +915,7 @@ TEST_F(PeerConnectionFunctionalityTest, peerConnectionAnswerCloseConnection) RtcConfiguration configuration; PRtcPeerConnection offerPc = NULL, answerPc = NULL; - if (!mAccessKeyIdSet) { - return; - } - + ASSERT_EQ(TRUE, mAccessKeyIdSet); MEMSET(&configuration, 0x00, SIZEOF(RtcConfiguration)); initializeSignalingClient(); @@ -960,9 +938,7 @@ TEST_F(PeerConnectionFunctionalityTest, peerConnectionAnswerCloseConnection) TEST_F(PeerConnectionFunctionalityTest, DISABLED_exchangeMediaThroughTurnRandomStop) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); initializeSignalingClient(); diff --git a/tst/SignalingApiFunctionalityTest.cpp b/tst/SignalingApiFunctionalityTest.cpp index 274bbe89ed..3197bf15aa 100644 --- a/tst/SignalingApiFunctionalityTest.cpp +++ b/tst/SignalingApiFunctionalityTest.cpp @@ -821,9 +821,7 @@ TEST_F(SignalingApiFunctionalityTest, invalidChannelInfoInput) TEST_F(SignalingApiFunctionalityTest, iceReconnectEmulation) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -908,9 +906,7 @@ TEST_F(SignalingApiFunctionalityTest, iceReconnectEmulation) TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedVariations) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -1173,10 +1169,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedVariatio TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedVariations) { - if (!mAccessKeyIdSet) { - return; - } - + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; SignalingClientInfoInternal clientInfoInternal; @@ -1441,9 +1434,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedVariations) TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedAuthExpiration) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -1564,9 +1555,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedAuthExpi TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedAuthExpiration) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -1690,9 +1679,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedAuthExpirat TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedWithFaultInjectionRecovered) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -1807,9 +1794,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedWithFaul TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedWithFaultInjectionRecovered) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -1926,9 +1911,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedWithFaultIn TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedWithFaultInjectionNotRecovered) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2041,9 +2024,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedWithFaul TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedWithFaultInjectionNot1669) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2159,9 +2140,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedWithFaultIn TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedWithBadAuth) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2280,9 +2259,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshNotConnectedWithBadA TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedWithBadAuth) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2405,9 +2382,7 @@ TEST_F(SignalingApiFunctionalityTest, iceServerConfigRefreshConnectedWithBadAuth TEST_F(SignalingApiFunctionalityTest, goAwayEmulation) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2491,9 +2466,7 @@ TEST_F(SignalingApiFunctionalityTest, goAwayEmulation) TEST_F(SignalingApiFunctionalityTest, unknownMessageTypeEmulation) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2581,9 +2554,7 @@ TEST_F(SignalingApiFunctionalityTest, unknownMessageTypeEmulation) TEST_F(SignalingApiFunctionalityTest, connectTimeoutEmulation) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2606,7 +2577,7 @@ TEST_F(SignalingApiFunctionalityTest, connectTimeoutEmulation) clientInfoInternal.signalingClientInfo.version = SIGNALING_CLIENT_INFO_CURRENT_VERSION; clientInfoInternal.signalingClientInfo.loggingLevel = mLogLevel; STRCPY(clientInfoInternal.signalingClientInfo.clientId, TEST_SIGNALING_MASTER_CLIENT_ID); - clientInfoInternal.connectTimeout = 100 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND; + clientInfoInternal.connectTimeout = 1 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND; setupSignalingStateMachineRetryStrategyCallbacks(&clientInfoInternal); pKvsRetryStrategyCallbacks = &(clientInfoInternal.signalingStateMachineRetryStrategyCallbacks); @@ -2704,9 +2675,7 @@ TEST_F(SignalingApiFunctionalityTest, connectTimeoutEmulation) TEST_F(SignalingApiFunctionalityTest, channelInfoArnSkipDescribe) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2838,9 +2807,7 @@ TEST_F(SignalingApiFunctionalityTest, channelInfoArnSkipDescribe) TEST_F(SignalingApiFunctionalityTest, deleteChannelCreatedWithArn) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -2972,9 +2939,7 @@ TEST_F(SignalingApiFunctionalityTest, deleteChannelCreatedWithArn) TEST_F(SignalingApiFunctionalityTest, deleteChannelCreatedAuthExpiration) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -3085,9 +3050,7 @@ TEST_F(SignalingApiFunctionalityTest, deleteChannelCreatedAuthExpiration) TEST_F(SignalingApiFunctionalityTest, signalingClientDisconnectSyncVariations) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); initializeSignalingClient(); @@ -3131,9 +3094,7 @@ TEST_F(SignalingApiFunctionalityTest, signalingClientDisconnectSyncVariations) TEST_F(SignalingApiFunctionalityTest, cachingWithFaultInjection) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -3267,9 +3228,7 @@ TEST_F(SignalingApiFunctionalityTest, cachingWithFaultInjection) TEST_F(SignalingApiFunctionalityTest, fileCachingTest) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -3362,9 +3321,12 @@ TEST_F(SignalingApiFunctionalityTest, fileCachingTest) EXPECT_EQ(STATUS_SUCCESS, freeSignalingClient(&signalingHandle)); } - /* describeCount and getEndpointCount should only increase by 1 because they are cached for all channels except one */ - EXPECT_TRUE(describeCount > describeCountNoCache && (describeCount - describeCountNoCache) == 1); - EXPECT_TRUE(getEndpointCount > getEndpointCountNoCache && (getEndpointCount - 2 * getEndpointCountNoCache) == 1); + DLOGD("describeCount: %d, describeCountNoCache: %d", describeCount, describeCountNoCache); + DLOGD("getEndpointCount: %d, getEndpointCountNoCache: %d", getEndpointCount, getEndpointCountNoCache); + + /* describeCount and getEndpointCount should only increase by 2 because they are cached for all channels except one and we iterate twice*/ + EXPECT_TRUE(describeCount > describeCountNoCache && (describeCount - describeCountNoCache) == 2); + EXPECT_TRUE(getEndpointCount > getEndpointCountNoCache && (getEndpointCount - 2*getEndpointCountNoCache) == 2); } TEST_F(SignalingApiFunctionalityTest, fileCachingUpdateCache) @@ -3523,9 +3485,7 @@ TEST_F(SignalingApiFunctionalityTest, fileCachingUpdateFullMultiChannelCache) TEST_F(SignalingApiFunctionalityTest, receivingIceConfigOffer) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -3711,9 +3671,7 @@ TEST_F(SignalingApiFunctionalityTest, receivingIceConfigOffer) TEST_F(SignalingApiFunctionalityTest, receivingIceConfigOffer_SlowClockSkew) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; @@ -3903,9 +3861,7 @@ TEST_F(SignalingApiFunctionalityTest, receivingIceConfigOffer_SlowClockSkew) TEST_F(SignalingApiFunctionalityTest, receivingIceConfigOffer_FastClockSkew) { - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); ChannelInfo channelInfo; SignalingClientCallbacks signalingClientCallbacks; diff --git a/tst/SignalingApiTest.cpp b/tst/SignalingApiTest.cpp index 6cab41140a..29652b8544 100644 --- a/tst/SignalingApiTest.cpp +++ b/tst/SignalingApiTest.cpp @@ -89,14 +89,22 @@ TEST_F(SignalingApiTest, signalingSendMessageSyncFileCredsProvider) PAwsCredentialProvider pAwsCredentialProvider = NULL; CHAR fileContent[10000]; UINT32 length = ARRAY_SIZE(fileContent); + CHAR futureTime[] = "2200-06-05T09:39:36Z"; - if (!mAccessKeyIdSet) { - return; - } - // Store the credentials in a file under the current dir - length = SNPRINTF(fileContent, length, "CREDENTIALS %s %s", mAccessKey, mSecretKey); - ASSERT_GT(ARRAY_SIZE(fileContent), length); + ASSERT_EQ(TRUE, mAccessKeyIdSet); + + if (mSessionToken == NULL) { + // Store the credentials in a file under the current dir + length = SNPRINTF(fileContent, length, "CREDENTIALS %s %s", mAccessKey, mSecretKey); + ASSERT_GT(ARRAY_SIZE(fileContent), length); + } else { + // test Temp Creds + // "CREDENTIALS accessKey expiration secretKey sessionToken" + length = SNPRINTF(fileContent, length, "CREDENTIALS %s %s %s %s", mAccessKey, futureTime, mSecretKey, mSessionToken); + ASSERT_GT(ARRAY_SIZE(fileContent), length); + } + ASSERT_EQ(STATUS_SUCCESS, writeFile(TEST_FILE_CREDENTIALS_FILE_PATH, FALSE, FALSE, (PBYTE) fileContent, length)); // Create file creds provider from the file @@ -280,9 +288,7 @@ TEST_F(SignalingApiTest, signalingClientGetMetrics) EXPECT_NE(STATUS_SUCCESS, signalingClientGetMetrics(INVALID_SIGNALING_CLIENT_HANDLE_VALUE, NULL)); EXPECT_NE(STATUS_SUCCESS, signalingClientGetMetrics(mSignalingClientHandle, NULL)); - if (!mAccessKeyIdSet) { - return; - } + ASSERT_EQ(TRUE, mAccessKeyIdSet); initializeSignalingClient(); // Valid call diff --git a/tst/suppressions/TSAN.supp b/tst/suppressions/TSAN.supp index 636d016122..0c1179bfbd 100644 --- a/tst/suppressions/TSAN.supp +++ b/tst/suppressions/TSAN.supp @@ -176,4 +176,4 @@ deadlock:com::amazonaws::kinesis::video::webrtcclient::DtlsFunctionalityTest::cr # instead of flagging each individual instance of the test. deadlock:lwsListenerHandler deadlock:connectSignalingChannelLws -race:lwsListenerHandler +race:lwsListenerHandler \ No newline at end of file