generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 31
kn: implement SystemDefaultProvider for Native
#1231
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
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
a4734c7
fix: create JMESPATH flattenIfPossible functions for Lists (#1169)
0marperez 7911a94
chore: release 1.3.30
aws-sdk-kotlin-ci 7085c8a
chore: bump snapshot version to 1.3.31-SNAPSHOT
aws-sdk-kotlin-ci 4575023
misc: enhance support for replayable instances of `InputStream` (#1197)
lauzadis b0a4bac
chore: release 1.3.31
aws-sdk-kotlin-ci 80f4538
chore: bump snapshot version to 1.3.32-SNAPSHOT
aws-sdk-kotlin-ci e9d16a9
fix: CBOR protocol test assertions / blob serialization (#1198)
lauzadis 48849a1
fix: correctly serialize subset of shape's members when configured (#…
lauzadis ded3a4b
chore: release 1.3.32
aws-sdk-kotlin-ci d97e8ba
chore: bump snapshot version to 1.3.33-SNAPSHOT
aws-sdk-kotlin-ci 78f17f3
chore: add *-main to branch workflows (#1209)
ianbotsf d06ee0a
chore: add .kotlin/ to .gitignore (#1208)
ianbotsf d2e7c91
chore: smithy version bump (#1213)
0marperez 5a2df8f
chore: release 1.3.33
aws-sdk-kotlin-ci 003633b
chore: bump snapshot version to 1.3.34-SNAPSHOT
aws-sdk-kotlin-ci 5f5ec8f
feat: add `AuthTokenGenerator` (#1212)
lauzadis 3fe1b5e
chore: release 1.3.34
aws-sdk-kotlin-ci 0bba308
chore: bump snapshot version to 1.3.35-SNAPSHOT
aws-sdk-kotlin-ci 52e4439
misc: merge v1.4 into main (#1218)
0marperez e0c25d6
feat: support default checksums (#1191)
0marperez 14e0958
chore: release 1.4.0
aws-sdk-kotlin-ci ed95d7b
chore: bump snapshot version to 1.4.1-SNAPSHOT
aws-sdk-kotlin-ci a4ace35
fix: add 0.9.x aws-crt-kotlin transform (#1220)
lauzadis 15e5f0c
fix: Ensure `Host` header is included when signing auth tokens (#1222)
lauzadis 447ac10
chore: release 1.4.1
aws-sdk-kotlin-ci 0f8db44
chore: bump snapshot version to 1.4.2-SNAPSHOT
aws-sdk-kotlin-ci 8b33693
fix: address various failing protocol tests (#1223)
lauzadis 03badf9
misc: re-enable `kotlinWarningsAsErrors=true` (#1224)
lauzadis 9f44cdb
fix: ignore hop-by-hop headers when signing requests (#1227)
ianbotsf 97ac447
chore: release 1.4.2
aws-sdk-kotlin-ci b7e50e3
chore: bump snapshot version to 1.4.3-SNAPSHOT
aws-sdk-kotlin-ci 35ef3a1
Implement PlatformNative (except for getAllEnvVars), add `deleteFile`…
lauzadis 002099b
ktlintFormat
lauzadis f2572f6
Use upload-artifact@v4
lauzadis 9c201e2
apiDump
lauzadis c1f2eef
Rename test to `SystemPlatformProviderTest`
lauzadis e6f0735
Check USERPROFILE too
lauzadis e6357f9
misc: add telemetry configuration to DefaultAwsSigner (#1226)
xinsong-cui 22886ed
Remove `deleteFile`, use temp dir
lauzadis 992efbc
Remove usage of deleteFile
lauzadis a8a22da
Use correct tempdir on windows
lauzadis 7115a34
ktlint
lauzadis c5a138f
Remove transfer-encoding from expected signed headers
lauzadis 0323e98
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-p…
lauzadis cda0523
Revert
lauzadis e5c0f64
Merge branch 'kn-main' of github.com:smithy-lang/smithy-kotlin into k…
lauzadis d0dc45d
Implement getAllEnvVars
lauzadis a674cf4
Update filePathSeparator for Windows
lauzadis 426bcfe
e -> _
lauzadis f4fdfe3
Merge branch 'kn-main' of github.com:smithy-lang/smithy-kotlin into k…
lauzadis aa44461
PR feedback
lauzadis 6bc63cf
Add LinuxX64 test
lauzadis 5e5c541
ktlint
lauzadis e282e5c
Expand support of Apple platforms
lauzadis ee85998
Remove debug test
lauzadis 7dc3766
ktlint
lauzadis 8142608
apiDump new OsFamily
lauzadis 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
62 changes: 62 additions & 0 deletions
62
...ime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/SystemPlatformProviderTest.kt
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,62 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package aws.smithy.kotlin.runtime.util | ||
|
|
||
| import kotlinx.coroutines.test.runTest | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertContentEquals | ||
| import kotlin.test.assertNotEquals | ||
| import kotlin.test.assertNotNull | ||
| import kotlin.test.assertNull | ||
| import kotlin.test.assertTrue | ||
|
|
||
| class SystemPlatformProviderTest { | ||
| @Test | ||
| fun testReadWriteFile() = runTest { | ||
| val ps = PlatformProvider.System | ||
|
|
||
| val tempDir = if (ps.osInfo().family == OsFamily.Windows) { | ||
| requireNotNull(ps.getenv("TEMP")) { "%TEMP% unexpectedly null" } | ||
| } else { | ||
| "/tmp" | ||
| } | ||
| val path = "$tempDir/testReadWriteFile-${Uuid.random()}.txt" | ||
|
|
||
| val expected = "Hello, File!".encodeToByteArray() | ||
|
|
||
| ps.writeFile(path, expected) | ||
| assertTrue(ps.fileExists(path)) | ||
|
|
||
| val actual = ps.readFileOrNull(path) | ||
| assertContentEquals(expected, actual) | ||
| } | ||
|
|
||
| @Test | ||
| fun testGetEnv() = runTest { | ||
| val envVarKeys = listOf("PATH", "USERPROFILE") // PATH is not set on Windows CI | ||
| assertNotNull( | ||
| envVarKeys.firstNotNullOfOrNull { PlatformProvider.System.getenv(it) }, | ||
| ) | ||
|
|
||
| assertNull(PlatformProvider.System.getenv("THIS_ENV_VAR_IS_NOT_SET")) | ||
| } | ||
|
|
||
| @Test | ||
| fun testGetAllEnvVars() = runTest { | ||
| val allEnv = PlatformProvider.System.getAllEnvVars() | ||
| assertTrue(allEnv.isNotEmpty()) | ||
|
|
||
| val envVarKeys = listOf("PATH", "USERPROFILE") // PATH is not set on Windows CI | ||
| assertTrue( | ||
| envVarKeys.any { allEnv.contains(it) }, | ||
| ) | ||
| } | ||
|
|
||
| @Test | ||
| fun testOsInfo() = runTest { | ||
| val osInfo = PlatformProvider.System.osInfo() | ||
| assertNotEquals(OsFamily.Unknown, osInfo.family) | ||
| } | ||
| } | ||
17 changes: 17 additions & 0 deletions
17
...e-core/linuxX64/test/aws/smithy/kotlin/runtime/util/SystemPlatformProviderLinuxX64Test.kt
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,17 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package aws.smithy.kotlin.runtime.util | ||
|
|
||
| import kotlinx.coroutines.test.runTest | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertEquals | ||
|
|
||
| class SystemPlatformProviderLinuxX64Test { | ||
| @Test | ||
| fun testOsInfo() = runTest { | ||
| val osInfo = PlatformProvider.System.osInfo() | ||
| assertEquals(OsFamily.Linux, osInfo.family) | ||
| } | ||
| } |
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
12 changes: 12 additions & 0 deletions
12
runtime/runtime-core/native/src/nativeInterop/cinterop/environ.h
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,12 @@ | ||
| #ifndef ENVIRON_H | ||
| #define ENVIRON_H | ||
|
|
||
| // External declaration to get environment variables | ||
| extern char **environ; | ||
|
|
||
| // Helper function to get the environ pointer | ||
| char** get_environ_ptr() { | ||
| return environ; | ||
| } | ||
|
|
||
| #endif |
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.
Question: Do we have tests anywhere to verify that the correct OS family is returned as opposed to verifying the incorrect one isn't?
Uh oh!
There was an error while loading. Please reload this page.
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.
No we don't. Since this is a common test it's not possible to assert on a specific OS family. I'll try making a target-specific source set (i.e.
linuxx64) and add a test there.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.
Added a LinuxX64 test