Skip to content

Commit 89fd3a6

Browse files
authored
Reprovision Storage Integration test backend (#256)
* - reprovisioned storage resource in test account - Moved AuthHelper to AmplifyTestCommon for API and Storage tests - Adding readme for integration test set up * address PR comments * - Recreated Users and hiding them in the credentials.json file - Storage tests use unique UUIDs as keys to allow parallel execution - updated README with credentials.json structure - Added for API's GraphQLWithUserPool tests as well * improve AuthHelper error check * moving some setup to static set up * finish testing after merge
1 parent fdd09aa commit 89fd3a6

File tree

24 files changed

+2294
-2085
lines changed

24 files changed

+2294
-2085
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ AWS*.framework
3131

3232
# Stuff that can't be committed #
3333
######################
34-
credentials.json
34+
*credentials.json
3535
Pods
3636
Podfile.lock
3737
Documentation

Amplify.xcodeproj/project.pbxproj

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
21D79FE12377BF4B0057D00D /* AuthProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D79FE02377BF4B0057D00D /* AuthProvider.swift */; };
8585
21D79FE32377F4120057D00D /* SubscriptionConnectionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D79FE22377F4120057D00D /* SubscriptionConnectionState.swift */; };
8686
21F40A3223A160FC0074678E /* GraphQLDocument+DeleteSyncMutation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3123A160FC0074678E /* GraphQLDocument+DeleteSyncMutation.swift */; };
87+
21F40A3A23A294770074678E /* TestConfigHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3923A294770074678E /* TestConfigHelper.swift */; };
88+
21F40A3C23A2952C0074678E /* AuthHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3B23A2952C0074678E /* AuthHelper.swift */; };
89+
21F40A3E23A295390074678E /* AWSMobileClient+Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3D23A295390074678E /* AWSMobileClient+Message.swift */; };
90+
21F40A4023A295470074678E /* TestCommonConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21F40A3F23A295470074678E /* TestCommonConstants.swift */; };
8791
21FFF988230B7B2C005878EA /* AsychronousOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FFF986230B7A5D005878EA /* AsychronousOperation.swift */; };
8892
21FFF98E230C81E6005878EA /* StorageAccessLevel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FFF98D230C81E6005878EA /* StorageAccessLevel.swift */; };
8993
21FFF994230C96CB005878EA /* StorageUploadDataOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FFF98F230C96CA005878EA /* StorageUploadDataOperation.swift */; };
@@ -585,6 +589,10 @@
585589
21D79FE02377BF4B0057D00D /* AuthProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthProvider.swift; sourceTree = "<group>"; };
586590
21D79FE22377F4120057D00D /* SubscriptionConnectionState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionConnectionState.swift; sourceTree = "<group>"; };
587591
21F40A3123A160FC0074678E /* GraphQLDocument+DeleteSyncMutation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "GraphQLDocument+DeleteSyncMutation.swift"; sourceTree = "<group>"; };
592+
21F40A3923A294770074678E /* TestConfigHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestConfigHelper.swift; sourceTree = "<group>"; };
593+
21F40A3B23A2952C0074678E /* AuthHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthHelper.swift; sourceTree = "<group>"; };
594+
21F40A3D23A295390074678E /* AWSMobileClient+Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AWSMobileClient+Message.swift"; sourceTree = "<group>"; };
595+
21F40A3F23A295470074678E /* TestCommonConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestCommonConstants.swift; sourceTree = "<group>"; };
588596
21FFF986230B7A5D005878EA /* AsychronousOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsychronousOperation.swift; sourceTree = "<group>"; };
589597
21FFF98D230C81E6005878EA /* StorageAccessLevel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageAccessLevel.swift; sourceTree = "<group>"; };
590598
21FFF98F230C96CA005878EA /* StorageUploadDataOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageUploadDataOperation.swift; sourceTree = "<group>"; };
@@ -2031,7 +2039,10 @@
20312039
FA9D6C20238DF06B00C7DD9F /* Helpers */ = {
20322040
isa = PBXGroup;
20332041
children = (
2042+
21F40A3B23A2952C0074678E /* AuthHelper.swift */,
2043+
21F40A3D23A295390074678E /* AWSMobileClient+Message.swift */,
20342044
FA176ED6238503C200C5C5F9 /* HubListenerTestUtilities.swift */,
2045+
21F40A3923A294770074678E /* TestConfigHelper.swift */,
20352046
);
20362047
path = Helpers;
20372048
sourceTree = "<group>";
@@ -2406,11 +2417,12 @@
24062417
isa = PBXGroup;
24072418
children = (
24082419
FACA36062327FBD4000E74F6 /* AmplifyTestCommon.h */,
2409-
FACA36072327FBD4000E74F6 /* Info.plist */,
2410-
FACF52032329633500646E10 /* TestExtensions.swift */,
24112420
FA9D6C20238DF06B00C7DD9F /* Helpers */,
2421+
FACA36072327FBD4000E74F6 /* Info.plist */,
24122422
FAC23577227A056F00424678 /* Mocks */,
24132423
B952182D237E21B900F53237 /* Models */,
2424+
21F40A3F23A295470074678E /* TestCommonConstants.swift */,
2425+
FACF52032329633500646E10 /* TestExtensions.swift */,
24142426
);
24152427
path = AmplifyTestCommon;
24162428
sourceTree = "<group>";
@@ -3714,12 +3726,14 @@
37143726
B9FAA116238799D3009414B4 /* Author.swift in Sources */,
37153727
B9521833237E21BA00F53237 /* Comment+Schema.swift in Sources */,
37163728
FA176ED7238503C200C5C5F9 /* HubListenerTestUtilities.swift in Sources */,
3729+
21F40A3A23A294770074678E /* TestConfigHelper.swift in Sources */,
37173730
B4BD6B3723708C6700A1F0A7 /* MockPredictionsCategoryPlugin.swift in Sources */,
37183731
FACA361C2327FC7D000E74F6 /* MockHubCategoryPlugin.swift in Sources */,
37193732
FAD3937F23820DAE00463F5E /* MockDataStoreCategoryPlugin.swift in Sources */,
37203733
FACA361A2327FC69000E74F6 /* MockStorageCategoryPlugin.swift in Sources */,
37213734
B9521837237E21BA00F53237 /* Post.swift in Sources */,
37223735
B9FAA11A23879AC8009414B4 /* BookAuthor.swift in Sources */,
3736+
21F40A3E23A295390074678E /* AWSMobileClient+Message.swift in Sources */,
37233737
FAA2E8BC239FFC7700E420EA /* MockModels.swift in Sources */,
37243738
B9FAA11E23879B9F009414B4 /* Book+Schema.swift in Sources */,
37253739
FACA361B2327FC74000E74F6 /* MockLoggingCategoryPlugin.swift in Sources */,
@@ -3735,10 +3749,12 @@
37353749
FACA361D2327FC84000E74F6 /* MockAPICategoryPlugin.swift in Sources */,
37363750
B9FAA11023878C5E009414B4 /* UserProfile.swift in Sources */,
37373751
B9FAA12023879BD0009414B4 /* BookAuthor+Schema.swift in Sources */,
3752+
21F40A4023A295470074678E /* TestCommonConstants.swift in Sources */,
37383753
B9521835237E21BA00F53237 /* Comment.swift in Sources */,
37393754
FACA361E2327FC8E000E74F6 /* MockAnalyticsCategoryPlugin.swift in Sources */,
37403755
2129BE012394627B006363A1 /* PostCommentModelRegistration.swift in Sources */,
37413756
B9FAA10E23878BF3009414B4 /* UserAccount.swift in Sources */,
3757+
21F40A3C23A2952C0074678E /* AuthHelper.swift in Sources */,
37423758
FA1846EE23998E44009B9D01 /* MockAPIResponders.swift in Sources */,
37433759
);
37443760
runOnlyForDeploymentPostprocessing = 0;

AmplifyPlugins/API/APICategoryPlugin.xcodeproj/project.pbxproj

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
21409C5E2384DE2C000A53C9 /* AWSAPIPlugin+GraphQLModelBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C5D2384DE2C000A53C9 /* AWSAPIPlugin+GraphQLModelBehavior.swift */; };
1313
21409C602384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C5F2384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift */; };
1414
21409C7223850BEE000A53C9 /* Todo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7123850BEE000A53C9 /* Todo.swift */; };
15-
21409C7423850BFD000A53C9 /* AWSMobileClient+Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7323850BFD000A53C9 /* AWSMobileClient+Message.swift */; };
1615
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7523850D1D000A53C9 /* BlogPostComment.swift */; };
17-
21409C8123851524000A53C9 /* TestCommonConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C8023851524000A53C9 /* TestCommonConstants.swift */; };
18-
21409C8323851796000A53C9 /* AuthHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C8223851796000A53C9 /* AuthHelper.swift */; };
19-
21598CE2239EE10100529F29 /* TestConfigHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21598CE1239EE10100529F29 /* TestConfigHelper.swift */; };
2016
21598CE3239FF54E00529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */; };
2117
21598CE4239FF61300529F29 /* RESTWithIAMIntegrationTests-awsconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CDE239EDF1000529F29 /* RESTWithIAMIntegrationTests-awsconfiguration.json */; };
2218
21598CF223A0164A00529F29 /* GraphQLWithUserPoolIntegrationTests-amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CF023A0164900529F29 /* GraphQLWithUserPoolIntegrationTests-amplifyconfiguration.json */; };
@@ -32,6 +28,7 @@
3228
217856A423810B9400A30D19 /* AWSAPICategoryPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B478F5FB2374DBF400C4F92B /* AWSAPICategoryPlugin.framework */; };
3329
217856B72381F19400A30D19 /* AWSAPICategoryPluginEndpointType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856B62381F19300A30D19 /* AWSAPICategoryPluginEndpointType.swift */; };
3430
217856C22383339D00A30D19 /* GraphQLModelBasedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856C12383339D00A30D19 /* GraphQLModelBasedTests.swift */; };
31+
21A3EFC623A946590095D8E6 /* GraphQLWithUserPoolIntegrationTests-credentials.json in Resources */ = {isa = PBXBuildFile; fileRef = 21A3EFC523A946580095D8E6 /* GraphQLWithUserPoolIntegrationTests-credentials.json */; };
3532
21D7A0DF237B54D90057D00D /* AWSGraphQLOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D7A08D237B54D90057D00D /* AWSGraphQLOperation.swift */; };
3633
21D7A0E0237B54D90057D00D /* AWSGraphQLSubscriptionOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D7A08E237B54D90057D00D /* AWSGraphQLSubscriptionOperation.swift */; };
3734
21D7A0E1237B54D90057D00D /* AWSRESTOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D7A08F237B54D90057D00D /* AWSRESTOperation.swift */; };
@@ -256,13 +253,9 @@
256253
21409C6723850A9E000A53C9 /* AWSAPICategoryPluginTestCommon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AWSAPICategoryPluginTestCommon.framework; sourceTree = BUILT_PRODUCTS_DIR; };
257254
21409C6A23850A9E000A53C9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
258255
21409C7123850BEE000A53C9 /* Todo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Todo.swift; sourceTree = "<group>"; };
259-
21409C7323850BFD000A53C9 /* AWSMobileClient+Message.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AWSMobileClient+Message.swift"; sourceTree = "<group>"; };
260256
21409C7523850D1D000A53C9 /* BlogPostComment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlogPostComment.swift; sourceTree = "<group>"; };
261-
21409C8023851524000A53C9 /* TestCommonConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestCommonConstants.swift; sourceTree = "<group>"; };
262-
21409C8223851796000A53C9 /* AuthHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthHelper.swift; sourceTree = "<group>"; };
263257
21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "RESTWithIAMIntegrationTests-amplifyconfiguration.json"; sourceTree = "<group>"; };
264258
21598CDE239EDF1000529F29 /* RESTWithIAMIntegrationTests-awsconfiguration.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "RESTWithIAMIntegrationTests-awsconfiguration.json"; sourceTree = "<group>"; };
265-
21598CE1239EE10100529F29 /* TestConfigHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestConfigHelper.swift; sourceTree = "<group>"; };
266259
21598CE5239FF8BD00529F29 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
267260
21598CE723A0036600529F29 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
268261
21598CE823A0037800529F29 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
@@ -284,6 +277,7 @@
284277
217856A323810B9400A30D19 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
285278
217856B62381F19300A30D19 /* AWSAPICategoryPluginEndpointType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AWSAPICategoryPluginEndpointType.swift; sourceTree = "<group>"; };
286279
217856C12383339D00A30D19 /* GraphQLModelBasedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GraphQLModelBasedTests.swift; sourceTree = "<group>"; };
280+
21A3EFC523A946580095D8E6 /* GraphQLWithUserPoolIntegrationTests-credentials.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "GraphQLWithUserPoolIntegrationTests-credentials.json"; sourceTree = "<group>"; };
287281
21D7A08D237B54D90057D00D /* AWSGraphQLOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AWSGraphQLOperation.swift; sourceTree = "<group>"; };
288282
21D7A08E237B54D90057D00D /* AWSGraphQLSubscriptionOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AWSGraphQLSubscriptionOperation.swift; sourceTree = "<group>"; };
289283
21D7A08F237B54D90057D00D /* AWSRESTOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AWSRESTOperation.swift; sourceTree = "<group>"; };
@@ -543,12 +537,8 @@
543537
21409C6823850A9E000A53C9 /* AWSAPICategoryPluginTestCommon */ = {
544538
isa = PBXGroup;
545539
children = (
546-
21409C8223851796000A53C9 /* AuthHelper.swift */,
547-
21409C7323850BFD000A53C9 /* AWSMobileClient+Message.swift */,
548540
21409C6A23850A9E000A53C9 /* Info.plist */,
549541
21409C7F23850F3D000A53C9 /* Model */,
550-
21409C8023851524000A53C9 /* TestCommonConstants.swift */,
551-
21598CE1239EE10100529F29 /* TestConfigHelper.swift */,
552542
);
553543
path = AWSAPICategoryPluginTestCommon;
554544
sourceTree = "<group>";
@@ -654,6 +644,7 @@
654644
217856A023810B9400A30D19 /* GraphQLWithUserPoolIntegrationTests */ = {
655645
isa = PBXGroup;
656646
children = (
647+
21A3EFC523A946580095D8E6 /* GraphQLWithUserPoolIntegrationTests-credentials.json */,
657648
21598CF023A0164900529F29 /* GraphQLWithUserPoolIntegrationTests-amplifyconfiguration.json */,
658649
21598CF123A0164A00529F29 /* GraphQLWithUserPoolIntegrationTests-awsconfiguration.json */,
659650
217856A123810B9400A30D19 /* GraphQLWithUserPoolIntegrationTests.swift */,
@@ -1403,6 +1394,7 @@
14031394
21598CF223A0164A00529F29 /* GraphQLWithUserPoolIntegrationTests-amplifyconfiguration.json in Resources */,
14041395
21F40A2B23A0423C0074678E /* GraphQLSyncBasedTests-amplifyconfiguration.json in Resources */,
14051396
21F40A2E23A0707E0074678E /* GraphQLModelBasedTests-amplifyconfiguration.json in Resources */,
1397+
21A3EFC623A946590095D8E6 /* GraphQLWithUserPoolIntegrationTests-credentials.json in Resources */,
14061398
21598CF323A0164A00529F29 /* GraphQLWithUserPoolIntegrationTests-awsconfiguration.json in Resources */,
14071399
B478F6E22374E0CF00C4F92B /* LaunchScreen.storyboard in Resources */,
14081400
21598CE4239FF61300529F29 /* RESTWithIAMIntegrationTests-awsconfiguration.json in Resources */,
@@ -1948,11 +1940,7 @@
19481940
isa = PBXSourcesBuildPhase;
19491941
buildActionMask = 2147483647;
19501942
files = (
1951-
21409C7423850BFD000A53C9 /* AWSMobileClient+Message.swift in Sources */,
19521943
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */,
1953-
21409C8323851796000A53C9 /* AuthHelper.swift in Sources */,
1954-
21598CE2239EE10100529F29 /* TestConfigHelper.swift in Sources */,
1955-
21409C8123851524000A53C9 /* TestCommonConstants.swift in Sources */,
19561944
21409C7223850BEE000A53C9 /* Todo.swift in Sources */,
19571945
);
19581946
runOnlyForDeploymentPostprocessing = 0;

AmplifyPlugins/API/AWSAPICategoryPluginFunctionalTests/BlogPostCommentGraphQLWithAPIKey/BlogPostCommentGraphQLWithAPIKeyTests.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import AWSMobileClient
1111
import AWSAPICategoryPlugin
1212
@testable import Amplify
1313
@testable import AWSAPICategoryPluginTestCommon
14+
@testable import AmplifyTestCommon
1415

1516
// These test cover the more complex scenarios, compared to the Todo graphQL endpoint
1617
class BlogPostCommentGraphQLWithAPIKeyTests: XCTestCase {
@@ -248,8 +249,8 @@ class BlogPostCommentGraphQLWithAPIKeyTests: XCTestCase {
248249
return blog
249250
}
250251

251-
func createPost(postBlogId: String, title: String) -> Post? {
252-
var post: Post?
252+
func createPost(postBlogId: String, title: String) -> AWSAPICategoryPluginTestCommon.Post? {
253+
var post: AWSAPICategoryPluginTestCommon.Post?
253254
let completeInvoked = expectation(description: "request completed")
254255
let request = GraphQLRequest(apiName: BlogPostCommentGraphQLWithAPIKeyTests.blogPostGraphQLWithAPIKey,
255256
document: CreatePostMutation.document,
@@ -280,8 +281,8 @@ class BlogPostCommentGraphQLWithAPIKeyTests: XCTestCase {
280281
return post
281282
}
282283

283-
func createComment(commentPostId: String, content: String) -> Comment? {
284-
var comment: Comment?
284+
func createComment(commentPostId: String, content: String) -> AWSAPICategoryPluginTestCommon.Comment? {
285+
var comment: AWSAPICategoryPluginTestCommon.Comment?
285286
let completeInvoked = expectation(description: "request completed")
286287
let request = GraphQLRequest(apiName: BlogPostCommentGraphQLWithAPIKeyTests.blogPostGraphQLWithAPIKey,
287288
document: CreateCommentMutation.document,

0 commit comments

Comments
 (0)