-
Notifications
You must be signed in to change notification settings - Fork 359
Dual-Stack Endpoints Support #2104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stefankiesz
wants to merge
13
commits into
release-v1.12.1
Choose a base branch
from
dual-stack
base: release-v1.12.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
52df39f
Build LWS with IPv6 support
stefankiesz 62f9bc8
Samples to demonstrate how to set a dual-stack custom control plane …
stefankiesz 75237f3
Carry over changes to the other samples
stefankiesz eaaaf1b
Add check for empty custom ControlPlaneUrl
stefankiesz dfe9343
Switch to IS_NULL_OR_EMPTY_STRING
stefankiesz b78e6a3
Fix missing "!"
stefankiesz b29fd9b
One more spot for "!"
stefankiesz 60ade10
Add unit tests
stefankiesz 29db44c
Use dual-stack-support branch of CommonLWS (Producer C SDK)
stefankiesz 3aadd0a
Clean up tests, fix memory leak
stefankiesz 31fa00b
Fix comment
stefankiesz e0ca094
Address comments
stefankiesz 2707dd3
Clang format
stefankiesz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
#include "WebRTCClientTestFixture.h" | ||
|
||
namespace com { | ||
namespace amazonaws { | ||
namespace kinesis { | ||
namespace video { | ||
namespace webrtcclient { | ||
|
||
class DualStackEndpointsTest : public WebRtcClientTestBase { | ||
}; | ||
|
||
TEST_F(DualStackEndpointsTest, customControlPlaneEndpointBasicCase) | ||
{ | ||
STATUS retStatus; | ||
ChannelInfo channelInfo; | ||
memset(&channelInfo, 0, sizeof(channelInfo)); | ||
stefankiesz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
PChannelInfo pChannelInfo; | ||
CHAR originalCustomControlPlaneUrl[MAX_CONTROL_PLANE_URI_CHAR_LEN] = "https://kinesisvideo.us-west-2.api.aws"; | ||
CHAR validatedCustomControlPlaneUrl[MAX_CONTROL_PLANE_URI_CHAR_LEN] = {0}; | ||
|
||
// Make a deep copy of originalCustomControlPlaneUrl into validatedCustomControlPlaneUrl to save the value for later comparison. | ||
strncpy(validatedCustomControlPlaneUrl, originalCustomControlPlaneUrl, MAX_CONTROL_PLANE_URI_CHAR_LEN); | ||
validatedCustomControlPlaneUrl[MAX_CONTROL_PLANE_URI_CHAR_LEN - 1] = '\0'; | ||
|
||
channelInfo.pControlPlaneUrl = (PCHAR) validatedCustomControlPlaneUrl; | ||
|
||
// pChannelName must be set to make the createValidateChannelInfo call. | ||
channelInfo.pChannelName = "TestChannelName"; | ||
|
||
EXPECT_EQ(STATUS_SUCCESS, createValidateChannelInfo(&channelInfo, &pChannelInfo)); | ||
|
||
// Validate the ChanelInfo's Control Plane URL against the originalCustomControlPlaneUrl. | ||
stefankiesz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
EXPECT_STREQ(pChannelInfo->pControlPlaneUrl, (PCHAR) originalCustomControlPlaneUrl); | ||
|
||
freeChannelInfo(&pChannelInfo); | ||
} | ||
|
||
TEST_F(DualStackEndpointsTest, customControlPlaneEndpointEdgeCases) | ||
{ | ||
STATUS retStatus; | ||
ChannelInfo channelInfo; | ||
memset(&channelInfo, 0, sizeof(channelInfo)); | ||
PChannelInfo pChannelInfo; | ||
|
||
// TODO: Verify why we use MAX_URI_CHAR_LEN instead of MAX_CONTROL_PLANE_URI_CHAR_LEN for the custom URL. | ||
// MAX_URI_CHAR_LEN does not include the null terminator, so add 1. | ||
CHAR originalCustomControlPlaneUrl[MAX_URI_CHAR_LEN + 1] = {0}; | ||
CHAR validatedCustomControlPlaneUrl[MAX_URI_CHAR_LEN + 1] = {0}; | ||
CHAR expectedSdkGeneratedUri[MAX_CONTROL_PLANE_URI_CHAR_LEN] = {0}; | ||
|
||
// If createValidateChannelInfo needs to generate the URL, it will use DEFAULT_AWS_REGION since | ||
// we are not setting a region on ChannelInfo. | ||
SNPRINTF(expectedSdkGeneratedUri, sizeof(expectedSdkGeneratedUri), "%s%s.%s%s", | ||
CONTROL_PLANE_URI_PREFIX, KINESIS_VIDEO_SERVICE_NAME, DEFAULT_AWS_REGION, CONTROL_PLANE_URI_POSTFIX); | ||
|
||
channelInfo.pControlPlaneUrl = (PCHAR) validatedCustomControlPlaneUrl; | ||
|
||
// pChannelName must be set to make the createValidateChannelInfo call. | ||
channelInfo.pChannelName = "TestChannelName"; | ||
|
||
|
||
/* MAX URL ARRAY LENGTH (expect the custom URL be used) */ | ||
|
||
// Fill array full of non-null values, accounting for null terminator. | ||
memset(originalCustomControlPlaneUrl, 'X', sizeof(originalCustomControlPlaneUrl)); | ||
originalCustomControlPlaneUrl[sizeof(originalCustomControlPlaneUrl) - 1] = '\0'; | ||
|
||
// Make a deep copy of originalCustomControlPlaneUrl into validatedCustomControlPlaneUrl to save the value for | ||
// later comparison in case createValidateChannelInfo modified validatedCustomControlPlaneUrl. | ||
strncpy(validatedCustomControlPlaneUrl, originalCustomControlPlaneUrl, sizeof(validatedCustomControlPlaneUrl)); | ||
validatedCustomControlPlaneUrl[sizeof(validatedCustomControlPlaneUrl) - 1] = '\0'; | ||
|
||
channelInfo.pControlPlaneUrl = (PCHAR) validatedCustomControlPlaneUrl; | ||
|
||
EXPECT_EQ(STATUS_SUCCESS, createValidateChannelInfo(&channelInfo, &pChannelInfo)); | ||
|
||
// Validate the ChanelInfo's Control Plane URL against originalCustomControlPlaneUrl in case createValidateChannelInfo | ||
// modified validatedCustomControlPlaneUrl. | ||
EXPECT_STREQ(pChannelInfo->pControlPlaneUrl, (PCHAR) originalCustomControlPlaneUrl); | ||
freeChannelInfo(&pChannelInfo); | ||
|
||
|
||
/* EMPTY URL ARRAY (expect SDK to construct a proper URL) */ | ||
|
||
// Fill array with null values. | ||
memset(validatedCustomControlPlaneUrl, 0, sizeof(validatedCustomControlPlaneUrl)); | ||
|
||
channelInfo.pControlPlaneUrl = (PCHAR) validatedCustomControlPlaneUrl; | ||
|
||
EXPECT_EQ(STATUS_SUCCESS, createValidateChannelInfo(&channelInfo, &pChannelInfo)); | ||
stefankiesz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Validate the ChanelInfo's Control Plane URL should be the default one the SDK generated. | ||
EXPECT_STREQ(pChannelInfo->pControlPlaneUrl, (PCHAR) expectedSdkGeneratedUri); | ||
freeChannelInfo(&pChannelInfo); | ||
|
||
|
||
/* NULL URL ARRAY (expect SDK to construct a proper URL) */ | ||
|
||
channelInfo.pControlPlaneUrl = (PCHAR) NULL; | ||
|
||
EXPECT_EQ(STATUS_SUCCESS, createValidateChannelInfo(&channelInfo, &pChannelInfo)); | ||
EXPECT_STREQ(pChannelInfo->pControlPlaneUrl, (PCHAR) expectedSdkGeneratedUri); | ||
freeChannelInfo(&pChannelInfo); | ||
} | ||
|
||
|
||
TEST_F(DualStackEndpointsTest, customControlPlaneMaxEndpointLengthFailingCase) | ||
stefankiesz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
STATUS retStatus; | ||
ChannelInfo channelInfo; | ||
memset(&channelInfo, 0, sizeof(channelInfo)); | ||
PChannelInfo pChannelInfo; | ||
|
||
|
||
/* Exceed MAX URL ARRAY LENGTH (expect SDK to error out) */ | ||
|
||
// MAX_URI_CHAR_LEN does not include the null terminator, so add 2. | ||
CHAR customControlPlaneUrl[MAX_URI_CHAR_LEN + 2] = {0}; | ||
|
||
// pChannelName must be set to make the createValidateChannelInfo call. | ||
channelInfo.pChannelName = "TestChannelName"; | ||
|
||
// Fill array full of non-null values, accounting for null terminator. | ||
memset(customControlPlaneUrl, 'X', sizeof(customControlPlaneUrl)); | ||
customControlPlaneUrl[sizeof(customControlPlaneUrl) - 1] = '\0'; | ||
|
||
channelInfo.pControlPlaneUrl = (PCHAR) customControlPlaneUrl; | ||
|
||
EXPECT_EQ(STATUS_SIGNALING_INVALID_CPL_LENGTH, createValidateChannelInfo(&channelInfo, &pChannelInfo)); | ||
freeChannelInfo(&pChannelInfo); | ||
} | ||
|
||
|
||
} // namespace webrtcclient | ||
} // namespace video | ||
} // namespace kinesis | ||
} // namespace amazonaws | ||
} // namespace com | ||
stefankiesz marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would suggest adding an override for the endpoint for testing in pre-prod (eg via env)