Skip to content

Commit be11c59

Browse files
authored
chore: kickoff release
2 parents f4d2466 + 9fa521f commit be11c59

21 files changed

+2006
-447
lines changed

AmplifyPlugins/API/Tests/APIHostApp/APIHostApp.xcodeproj/project.pbxproj

Lines changed: 194 additions & 266 deletions
Large diffs are not rendered by default.

AmplifyPlugins/API/Tests/APIHostApp/APIHostApp.xcodeproj/xcshareddata/xcschemes/APIHostApp.xcscheme

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@
6060
ReferencedContainer = "container:APIHostApp.xcodeproj">
6161
</BuildableReference>
6262
</TestableReference>
63+
<TestableReference
64+
skipped = "NO"
65+
parallelizable = "YES">
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "2163D60B2BE96C90009689B1"
69+
BuildableName = "AWSAPIPluginGen2GraphQLTests.xctest"
70+
BlueprintName = "AWSAPIPluginGen2GraphQLTests"
71+
ReferencedContainer = "container:APIHostApp.xcodeproj">
72+
</BuildableReference>
73+
</TestableReference>
6374
</Testables>
6475
</TestAction>
6576
<LaunchAction
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@
1010
buildConfiguration = "Debug"
1111
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
1212
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
13-
shouldUseLaunchSchemeArgsEnv = "YES">
14-
<TestPlans>
15-
<TestPlanReference
16-
reference = "container:AWSAPIPluginFunctionalTests/AWSAPIPluginGen2FunctionalTests.xctestplan"
17-
default = "YES">
18-
</TestPlanReference>
19-
</TestPlans>
13+
shouldUseLaunchSchemeArgsEnv = "YES"
14+
shouldAutocreateTestPlan = "YES">
2015
<Testables>
2116
<TestableReference
22-
skipped = "NO">
17+
skipped = "NO"
18+
parallelizable = "YES">
2319
<BuildableReference
2420
BuildableIdentifier = "primary"
25-
BlueprintIdentifier = "21F7624D2BD6B0710048845A"
26-
BuildableName = "AWSAPIPluginGen2FunctionalTests.xctest"
27-
BlueprintName = "AWSAPIPluginGen2FunctionalTests"
21+
BlueprintIdentifier = "2163D60B2BE96C90009689B1"
22+
BuildableName = "AWSAPIPluginGen2GraphQLTests.xctest"
23+
BlueprintName = "AWSAPIPluginGen2GraphQLTests"
2824
ReferencedContainer = "container:APIHostApp.xcodeproj">
2925
</BuildableReference>
3026
</TestableReference>

AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/AWSAPIPluginGen2FunctionalTests.xctestplan

Lines changed: 0 additions & 39 deletions
This file was deleted.

AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/Base/TestConfigHelper.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,16 @@
66
//
77

88
import Foundation
9-
@_spi(InternalAmplifyConfiguration) @testable import Amplify
9+
@testable import Amplify
1010

1111
class TestConfigHelper {
1212

13-
static var useGen2Configuration: Bool {
14-
ProcessInfo.processInfo.arguments.contains("GEN2")
15-
}
16-
1713
static func retrieveAmplifyConfiguration(forResource: String) throws -> AmplifyConfiguration {
1814

1915
let data = try retrieve(forResource: forResource)
2016
return try AmplifyConfiguration.decodeAmplifyConfiguration(from: data)
2117
}
2218

23-
static func retrieveAmplifyOutputsData(forResource: String) throws -> AmplifyOutputsData {
24-
let data = try retrieve(forResource: forResource)
25-
return try AmplifyOutputsData.decodeAmplifyOutputsData(from: data)
26-
}
27-
2819
static func retrieveCredentials(forResource: String) throws -> [String: String] {
2920
let data = try retrieve(forResource: forResource)
3021

AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLModelBasedTests.swift

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import XCTest
1818
class GraphQLModelBasedTests: XCTestCase {
1919

2020
static let amplifyConfiguration = "testconfiguration/GraphQLModelBasedTests-amplifyconfiguration"
21-
static let amplifyOutputs = "testconfiguration/GraphQLModelBasedTests-amplify_outputs"
2221

2322
final public class PostCommentModelRegistration: AmplifyModelRegistration {
2423
public func registerModels(registry: ModelRegistry.Type) {
@@ -37,16 +36,10 @@ class GraphQLModelBasedTests: XCTestCase {
3736

3837
do {
3938
try Amplify.add(plugin: plugin)
40-
41-
if TestConfigHelper.useGen2Configuration {
42-
let amplifyConfig = try TestConfigHelper.retrieveAmplifyOutputsData(
43-
forResource: GraphQLModelBasedTests.amplifyOutputs)
44-
try Amplify.configure(amplifyConfig)
45-
} else {
46-
let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration(
47-
forResource: GraphQLModelBasedTests.amplifyConfiguration)
48-
try Amplify.configure(amplifyConfig)
49-
}
39+
let amplifyConfig = try TestConfigHelper.retrieveAmplifyConfiguration(
40+
forResource: GraphQLModelBasedTests.amplifyConfiguration)
41+
try Amplify.configure(amplifyConfig)
42+
5043
ModelRegistry.register(modelType: Comment.self)
5144
ModelRegistry.register(modelType: Post.self)
5245

AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/README.md

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -250,112 +250,3 @@ cp amplifyconfiguration.json ~/.aws-amplify/amplify-ios/testconfiguration/GraphQ
250250
```
251251
You can now run the tests!
252252

253-
254-
## Schema: AWSAPIPluginGen2FunctionalTests
255-
256-
The following steps demonstrate how to set up an GraphQL endpoint with AppSync using Amplify CLI (Gen2). The auth configured will be API Key.
257-
258-
### Set-up
259-
260-
At the time this was written, it follows the steps from here https://docs.amplify.aws/gen2/deploy-and-host/fullstack-branching/mono-and-multi-repos/
261-
262-
1. From a new folder, run `npm create amplify@beta`. This uses the following versions of the Amplify CLI, see `package.json` file below.
263-
264-
```json
265-
{
266-
...
267-
"devDependencies": {
268-
"@aws-amplify/backend": "^0.13.0-beta.14",
269-
"@aws-amplify/backend-cli": "^0.12.0-beta.16",
270-
"aws-cdk": "^2.134.0",
271-
"aws-cdk-lib": "^2.134.0",
272-
"constructs": "^10.3.0",
273-
"esbuild": "^0.20.2",
274-
"tsx": "^4.7.1",
275-
"typescript": "^5.4.3"
276-
},
277-
"dependencies": {
278-
"aws-amplify": "^6.0.25"
279-
}
280-
}
281-
282-
```
283-
2. Update `amplify/data/resource.ts` to allow `public` access. This allows using API Key as the auth type to perform CRUD operations against the Comment and Post models. The resulting file should look like this
284-
285-
```ts
286-
const schema = a.schema({
287-
Post: a
288-
.model({
289-
title: a.string().required(),
290-
content: a.string().required(),
291-
draft: a.boolean(),
292-
rating: a.float(),
293-
status: a.enum(["PRIVATE", "DRAFT", "PUBLISHED"]),
294-
comments: a.hasMany('Comment')
295-
})
296-
.authorization([a.allow.public()]),
297-
Comment: a
298-
.model({
299-
content: a.string().required(),
300-
post: a.belongsTo('Post'),
301-
})
302-
.authorization([a.allow.public()]),
303-
});
304-
```
305-
306-
3. (Optional) Update the API Key expiry to the maximum. This should be done if this backend is used for CI testing.
307-
308-
```
309-
export const data = defineData({
310-
schema,
311-
authorizationModes: {
312-
defaultAuthorizationMode: 'apiKey',
313-
// API Key is used for a.allow.public() rules
314-
apiKeyAuthorizationMode: {
315-
expiresInDays: 365,
316-
},
317-
},
318-
});
319-
```
320-
321-
4. Deploy the backend with npx amplify sandbox
322-
323-
For example, this deploys to a sandbox env and generates the amplify_outputs.json file.
324-
325-
```
326-
npx amplify sandbox --config-out-dir ./config --config-version 1 --profile [PROFILE]
327-
```
328-
329-
5. Copy the `amplify_outputs.json` file over to the test directory as `GraphQLModelBasedTests-amplify_outputs.json`. The tests will automatically pick this file up. Create the directories in this path first if it currently doesn't exist.
330-
331-
```
332-
cp amplify_outputs.json ~/.aws-amplify/amplify-ios/testconfiguration/GraphQLModelBasedTests-amplify_outputs.json
333-
```
334-
335-
6. (Optional) The code generated model files are already checked into the tests so you will only have to re-generate them if you are expecting modifications to them and replace the existing ones checked in.
336-
337-
```
338-
npx amplify generate graphql-client-code --format=modelgen --model-target=swift --branch main --app-id [APP_ID] --profile [AWS_PROFILE]
339-
```
340-
341-
### Deploying from a branch (Optional)
342-
343-
If you want to be able utilize Git commits for deployments
344-
345-
1. Commit and push the files to a git repository.
346-
347-
2. Navigate to the AWS Amplify console (https://us-east-1.console.aws.amazon.com/amplify/home?region=us-east-1#/)
348-
349-
3. Click on "Try Amplify Gen 2" button.
350-
351-
4. Choose "Option 2: Start with an existing app", and choose Github, and press Next.
352-
353-
5. Find the repository and branch, and click Next
354-
355-
6. Click "Save and deploy" and wait for deployment to finish.
356-
357-
7. Generate the `amplify_outputs.json` configuration file
358-
359-
```
360-
npx amplify generate config --branch main --app-id [APP_ID] --profile [AWS_PROFILE] --config-version 1
361-
```

0 commit comments

Comments
 (0)