Skip to content

Commit c3456b9

Browse files
disa6302hassanctechjdelapla
authored
Run unit tests which require creds (#1780)
* Run unit tests which require creds * TSAN supp to get past this and check if other tests pass * Reenable tsan failure * Isolate tsan * Enable all tests * Add locks around connectionClosed modification * Update SignalingApiFunctionalityTest.cpp * Have a different signaling send timeout for windows and non-windows platform * Change timer for timeout test to be unrealistic to actually force a timeout * Enable tests with codecov * Update SignalingApiFunctionalityTest.cpp fix broken test. future commit will include code change so arn doesn't take the place of the channel name so the channel end point cache numbers will also be low * Update SignalingApiTest.cpp if using temp creds need to use the temp creds file format --------- Co-authored-by: Hassan Sahibzada <hsahibza@amazon.com> Co-authored-by: James Delaplane <delaplan@amazon.com>
1 parent 913f469 commit c3456b9

File tree

12 files changed

+188
-133
lines changed

12 files changed

+188
-133
lines changed

.github/workflows/ci.yml

+103-5
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ jobs:
3030
AWS_KVS_LOG_LEVEL: 2
3131
LDFLAGS: -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
3232
CPATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
33+
permissions:
34+
id-token: write
35+
contents: read
3336
steps:
3437
- name: Clone repository
3538
uses: actions/checkout@v3
39+
- name: Configure AWS Credentials
40+
uses: aws-actions/configure-aws-credentials@v2
41+
with:
42+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
43+
aws-region: ${{ secrets.AWS_REGION }}
3644
- name: Build repository
3745
run: |
3846
mkdir build && cd build
@@ -48,9 +56,17 @@ jobs:
4856
CC: gcc
4957
CXX: g++
5058
AWS_KVS_LOG_LEVEL: 2
59+
permissions:
60+
id-token: write
61+
contents: read
5162
steps:
5263
- name: Clone repository
5364
uses: actions/checkout@v3
65+
- name: Configure AWS Credentials
66+
uses: aws-actions/configure-aws-credentials@v2
67+
with:
68+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
69+
aws-region: ${{ secrets.AWS_REGION }}
5470
- name: Build repository
5571
run: |
5672
mkdir build && cd build
@@ -66,9 +82,17 @@ jobs:
6682
AWS_KVS_LOG_LEVEL: 2
6783
LDFLAGS: -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
6884
CPATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
85+
permissions:
86+
id-token: write
87+
contents: read
6988
steps:
7089
- name: Clone repository
7190
uses: actions/checkout@v3
91+
- name: Configure AWS Credentials
92+
uses: aws-actions/configure-aws-credentials@v2
93+
with:
94+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
95+
aws-region: ${{ secrets.AWS_REGION }}
7296
- name: Build repository
7397
run: |
7498
mkdir build && cd build
@@ -82,9 +106,17 @@ jobs:
82106
runs-on: ubuntu-20.04
83107
env:
84108
AWS_KVS_LOG_LEVEL: 2
109+
permissions:
110+
id-token: write
111+
contents: read
85112
steps:
86113
- name: Clone repository
87114
uses: actions/checkout@v3
115+
- name: Configure AWS Credentials
116+
uses: aws-actions/configure-aws-credentials@v2
117+
with:
118+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
119+
aws-region: ${{ secrets.AWS_REGION }}
88120
- name: Build repository
89121
run: |
90122
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
@@ -108,9 +140,17 @@ jobs:
108140
CC: clang
109141
CXX: clang++
110142
AWS_KVS_LOG_LEVEL: 2
143+
permissions:
144+
id-token: write
145+
contents: read
111146
steps:
112147
- name: Clone repository
113148
uses: actions/checkout@v3
149+
- name: Configure AWS Credentials
150+
uses: aws-actions/configure-aws-credentials@v2
151+
with:
152+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
153+
aws-region: ${{ secrets.AWS_REGION }}
114154
- name: Install dependencies
115155
run: |
116156
sudo apt clean && sudo apt update
@@ -134,9 +174,17 @@ jobs:
134174
CC: clang
135175
CXX: clang++
136176
AWS_KVS_LOG_LEVEL: 2
177+
permissions:
178+
id-token: write
179+
contents: read
137180
steps:
138181
- name: Clone repository
139182
uses: actions/checkout@v3
183+
- name: Configure AWS Credentials
184+
uses: aws-actions/configure-aws-credentials@v2
185+
with:
186+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
187+
aws-region: ${{ secrets.AWS_REGION }}
140188
- name: Install dependencies
141189
run: |
142190
sudo apt clean && sudo apt update
@@ -177,13 +225,21 @@ jobs:
177225
thread-sanitizer:
178226
runs-on: ubuntu-20.04
179227
env:
180-
TSAN_OPTIONS: halt_on_error=1:suppressions=../tst/suppressions/TSAN.supp
228+
TSAN_OPTIONS: second_deadlock_stack=1:halt_on_error=1:suppressions=../tst/suppressions/TSAN.supp
181229
CC: clang
182230
CXX: clang++
183231
AWS_KVS_LOG_LEVEL: 2
232+
permissions:
233+
id-token: write
234+
contents: read
184235
steps:
185236
- name: Clone repository
186237
uses: actions/checkout@v3
238+
- name: Configure AWS Credentials
239+
uses: aws-actions/configure-aws-credentials@v2
240+
with:
241+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
242+
aws-region: ${{ secrets.AWS_REGION }}
187243
- name: Install dependencies
188244
run: |
189245
sudo apt clean && sudo apt update
@@ -204,9 +260,17 @@ jobs:
204260
env:
205261
AWS_KVS_LOG_LEVEL: 2
206262
CC: gcc-4.4
263+
permissions:
264+
id-token: write
265+
contents: read
207266
steps:
208267
- name: Clone repository
209268
uses: actions/checkout@v3
269+
- name: Configure AWS Credentials
270+
uses: aws-actions/configure-aws-credentials@v2
271+
with:
272+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
273+
aws-region: ${{ secrets.AWS_REGION }}
210274
- name: Install deps
211275
run: |
212276
sudo apt clean && sudo apt update
@@ -235,6 +299,9 @@ jobs:
235299
CC: gcc
236300
CXX: g++
237301
AWS_KVS_LOG_LEVEL: 2
302+
permissions:
303+
id-token: write
304+
contents: read
238305
steps:
239306
- name: Clone repository
240307
uses: actions/checkout@v3
@@ -252,9 +319,17 @@ jobs:
252319
runs-on: ubuntu-20.04
253320
env:
254321
AWS_KVS_LOG_LEVEL: 2
322+
permissions:
323+
id-token: write
324+
contents: read
255325
steps:
256326
- name: Clone repository
257327
uses: actions/checkout@v3
328+
- name: Configure AWS Credentials
329+
uses: aws-actions/configure-aws-credentials@v2
330+
with:
331+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
332+
aws-region: ${{ secrets.AWS_REGION }}
258333
- name: Install deps
259334
run: |
260335
sudo apt clean && sudo apt update
@@ -281,9 +356,17 @@ jobs:
281356
CC: clang
282357
CXX: clang++
283358
AWS_KVS_LOG_LEVEL: 2
359+
permissions:
360+
id-token: write
361+
contents: read
284362
steps:
285363
- name: Clone repository
286364
uses: actions/checkout@v3
365+
- name: Configure AWS Credentials
366+
uses: aws-actions/configure-aws-credentials@v2
367+
with:
368+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
369+
aws-region: ${{ secrets.AWS_REGION }}
287370
- name: Install dependencies
288371
run: |
289372
sudo apt clean && sudo apt update
@@ -311,10 +394,9 @@ jobs:
311394
- name: Clone repository
312395
uses: actions/checkout@v3
313396
- name: Configure AWS Credentials
314-
uses: aws-actions/configure-aws-credentials@v1-node16
397+
uses: aws-actions/configure-aws-credentials@v2
315398
with:
316399
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
317-
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
318400
aws-region: ${{ secrets.AWS_REGION }}
319401
- name: Build repository
320402
run: |
@@ -328,9 +410,17 @@ jobs:
328410
runs-on: ubuntu-20.04
329411
env:
330412
AWS_KVS_LOG_LEVEL: 2
413+
permissions:
414+
id-token: write
415+
contents: read
331416
steps:
332417
- name: Clone repository
333418
uses: actions/checkout@v3
419+
- name: Configure AWS Credentials
420+
uses: aws-actions/configure-aws-credentials@v2
421+
with:
422+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
423+
aws-region: ${{ secrets.AWS_REGION }}
334424
- name: Build repository
335425
run: |
336426
# 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:
346436
runs-on: windows-2022
347437
env:
348438
AWS_KVS_LOG_LEVEL: 1
439+
permissions:
440+
id-token: write
441+
contents: read
349442
steps:
350443
- name: Clone repository
351444
uses: actions/checkout@v3
445+
- name: Configure AWS Credentials
446+
uses: aws-actions/configure-aws-credentials@v2
447+
with:
448+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
449+
aws-region: ${{ secrets.AWS_REGION }}
352450
- name: Move cloned repo
353451
shell: powershell
354452
run: |
@@ -358,7 +456,7 @@ jobs:
358456
shell: powershell
359457
run: |
360458
choco install gstreamer --version=1.16.2
361-
choco install gstreamer-devel --version=1.16.2
459+
choco install gstreamer-devel --version=1.16.2
362460
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
363461
mkdir C:\tools\pthreads-w32-2-9-1-release\
364462
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:
467565
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
468566
mkdir build && cd build
469567
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
470-
make
568+
make

.github/workflows/codecov.yml

+8
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ on:
1111
jobs:
1212
linux-gcc-codecov:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write
16+
contents: read
1417
steps:
1518
- name: Fetch
1619
uses: actions/checkout@v3
1720
with:
1821
fetch-depth: 2
22+
- name: Configure AWS Credentials
23+
uses: aws-actions/configure-aws-credentials@v2
24+
with:
25+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
26+
aws-region: ${{ secrets.AWS_REGION }}
1927
- name: Run code coverage
2028
run: |
2129
mkdir build

.github/workflows/pr-desc-lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ jobs:
2727
error_occurred=0
2828
# Define minimum character count for each section
2929
MIN_CHARS=25
30-
30+
3131
# Extract contents
3232
# Extract contents
3333
what_changed=$(echo "$pr_description" | sed -n -e '/\*What was changed?\*/,/\*/p' | sed '$d' | sed '1d')
3434
why_changed=$(echo "$pr_description" | sed -n -e '/\*Why was it changed?\*/,/\*/p' | sed '$d' | sed '1d')
3535
how_changed=$(echo "$pr_description" | sed -n -e '/\*How was it changed?\*/,/\*/p' | sed '$d' | sed '1d')
3636
testing_done=$(echo "$pr_description" | sed -n -e '/\*What testing was done for the changes?\*/,/\*/p' | sed '$d' | sed '1d')
37-
37+
3838
if [[ ${#what_changed} -lt $MIN_CHARS ]]; then
3939
echo "PR description for what changed section is either missing or too short."
4040
error_occurred=1

CMake/Dependencies/libkvsCommonLws-CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include(ExternalProject)
66

77
ExternalProject_Add(libkvsCommonLws-download
88
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
9-
GIT_TAG daf742a0a53f72341e5b2df75a05ebe6d2557811
9+
GIT_TAG ab3b6331594dfbd0a59686dfb8dc4938bc86da1a
1010
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/build
1111
CMAKE_ARGS
1212
-DCMAKE_INSTALL_PREFIX=${OPEN_SRC_INSTALL_PREFIX}

src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -631,11 +631,17 @@ extern "C" {
631631
*/
632632
#define SIGNALING_CONNECT_TIMEOUT (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)
633633

634+
#ifdef _WIN32
635+
/**
636+
* Default timeout for sending data
637+
*/
638+
#define SIGNALING_SEND_TIMEOUT (15 * HUNDREDS_OF_NANOS_IN_A_SECOND)
639+
#else
634640
/**
635641
* Default timeout for sending data
636642
*/
637643
#define SIGNALING_SEND_TIMEOUT (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)
638-
644+
#endif
639645
/**
640646
* Default timeout for deleting a channel
641647
*/

src/source/Ice/SocketConnection.c

+5
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ STATUS freeSocketConnection(PSocketConnection* ppSocketConnection)
6666
CHK(ppSocketConnection != NULL, STATUS_NULL_ARG);
6767
pSocketConnection = *ppSocketConnection;
6868
CHK(pSocketConnection != NULL, retStatus);
69+
70+
// connectionClosed is accessed and modified when checking if socket connection is closed
71+
// Hence the modification needs to be protected
72+
MUTEX_LOCK(pSocketConnection->lock);
6973
ATOMIC_STORE_BOOL(&pSocketConnection->connectionClosed, TRUE);
74+
MUTEX_UNLOCK(pSocketConnection->lock);
7075

7176
// Await for the socket connection to be released
7277
shutdownTimeout = GETTIME() + KVS_ICE_TURN_CONNECTION_SHUTDOWN_TIMEOUT;

src/source/Ice/TurnConnection.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ STATUS freeTurnConnection(PTurnConnection* ppTurnConnection)
9090

9191
pTurnConnection = *ppTurnConnection;
9292

93+
// Ensure we are not freeing everything without cancelling the timer
9394
timerCallbackId = ATOMIC_EXCHANGE(&pTurnConnection->timerCallbackId, MAX_UINT32);
9495
if (timerCallbackId != MAX_UINT32) {
9596
CHK_LOG_ERR(timerQueueCancelTimer(pTurnConnection->timerQueueHandle, (UINT32) timerCallbackId, (UINT64) pTurnConnection));
9697
}
97-
9898
// shutdown control channel
9999
if (pTurnConnection->pControlChannel) {
100100
CHK_LOG_ERR(connectionListenerRemoveConnection(pTurnConnection->pConnectionListener, pTurnConnection->pControlChannel));
@@ -1076,7 +1076,9 @@ STATUS turnConnectionStepState(PTurnConnection pTurnConnection)
10761076
}
10771077

10781078
CHK_STATUS(turnConnectionFreePreAllocatedPackets(pTurnConnection));
1079-
CHK_STATUS(socketConnectionClosed(pTurnConnection->pControlChannel));
1079+
if (pTurnConnection != NULL) {
1080+
CHK_STATUS(socketConnectionClosed(pTurnConnection->pControlChannel));
1081+
}
10801082
pTurnConnection->state = STATUS_SUCCEEDED(pTurnConnection->errorStatus) ? TURN_STATE_NEW : TURN_STATE_FAILED;
10811083
ATOMIC_STORE_BOOL(&pTurnConnection->shutdownComplete, TRUE);
10821084
}

tst/IceFunctionalityTest.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,7 @@ TEST_F(IceFunctionalityTest, IceAgentPruneUnconnectedIceCandidatePairUnitTest)
640640

641641
TEST_F(IceFunctionalityTest, IceAgentCandidateGatheringTest)
642642
{
643-
if (!mAccessKeyIdSet) {
644-
return;
645-
}
643+
ASSERT_EQ(TRUE, mAccessKeyIdSet);
646644

647645
typedef struct {
648646
std::vector<std::string> list;

0 commit comments

Comments
 (0)