Skip to content

Commit

Permalink
Test Refactor with Firewalk (Alamofire#3215)
Browse files Browse the repository at this point in the history
* Test standardization and abstraction.

* Version updates.

* Update Authentication and DataStream tests.

* Test formatting.

* Update Download tests.

* Continue switching to Endpoint.

* Allow SwiftFormat to remove unnecessary fileprivate.

* Fix RequestModifier tests.

* Update RequestInterceptorTests.

* Update CombineTests.

* Update RequestTests.

* Update SessionTests.

* Update UploadTests.

* Update SessionTests.

* Start deprecating URL factory.

* Update SessionTests.

* Update RequestInterceptorTests.

* Update UploadTests.

* Update Cache and URLProtocol tests.

* Update ResponseTests.

* Update SessionDelegateTests.

* Update RequestTests.

* Update ValidationTests.

* Update SessionTests, CachedResponseHandlerTests.

* Update SessionTests and RequestTests.

* Don’t install Firewalk for build only config.

* Double data in progress test.

* Use Endpoint() instead of Endpoint.default.
  • Loading branch information
jshier authored Feb 1, 2021
1 parent eaf6e62 commit b5dfb35
Show file tree
Hide file tree
Showing 37 changed files with 1,515 additions and 1,166 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: macOS (5.2)
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire macOS" -destination "platform=macOS" clean test | xcpretty
macOS_Catalina_5_3:
Expand All @@ -35,6 +37,8 @@ jobs:
DEVELOPER_DIR: /Applications/Xcode_12.3.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: macOS (5.3)
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire macOS" -destination "platform=macOS" clean test | xcpretty
macOS_Big_Sur_5_3:
Expand All @@ -44,6 +48,8 @@ jobs:
DEVELOPER_DIR: /Applications/Xcode_12.3.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: macOS (5.3)
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire macOS" -destination "platform=macOS" clean test | xcpretty
Catalyst:
Expand All @@ -53,6 +59,8 @@ jobs:
DEVELOPER_DIR: /Applications/Xcode_12.3.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: Catalyst
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire iOS" -destination "platform=macOS" clean test | xcpretty
iOS:
Expand All @@ -65,6 +73,8 @@ jobs:
destination: ["OS=14.3,name=iPhone 12 Pro"] #, "OS=12.4,name=iPhone XS", "OS=11.4,name=iPhone X", "OS=10.3.1,name=iPhone SE"]
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: iOS - ${{ matrix.destination }}
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire iOS" -destination "${{ matrix.destination }}" clean test | xcpretty
tvOS:
Expand All @@ -77,6 +87,8 @@ jobs:
destination: ["OS=14.3,name=Apple TV 4K"] #, "OS=11.4,name=Apple TV 4K", "OS=10.2,name=Apple TV 1080p"]
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: tvOS - ${{ matrix.destination }}
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire tvOS" -destination "${{ matrix.destination }}" clean test | xcpretty
watchOS:
Expand All @@ -98,5 +110,7 @@ jobs:
DEVELOPER_DIR: /Applications/Xcode_12.3.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Install Firewalk
run: brew install alamofire/alamofire/firewalk && firewalk &
- name: SPM Test
run: swift test -c debug
18 changes: 9 additions & 9 deletions Alamofire.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
3172741E218BB1790039FFCC /* ParameterEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3172741C218BB1790039FFCC /* ParameterEncoder.swift */; };
3172741F218BB1790039FFCC /* ParameterEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3172741C218BB1790039FFCC /* ParameterEncoder.swift */; };
31727420218BB1790039FFCC /* ParameterEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3172741C218BB1790039FFCC /* ParameterEncoder.swift */; };
31727422218BB9A50039FFCC /* HTTPBin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31727421218BB9A50039FFCC /* HTTPBin.swift */; };
31727423218BB9A50039FFCC /* HTTPBin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31727421218BB9A50039FFCC /* HTTPBin.swift */; };
31727424218BB9A50039FFCC /* HTTPBin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31727421218BB9A50039FFCC /* HTTPBin.swift */; };
31727422218BB9A50039FFCC /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31727421218BB9A50039FFCC /* TestHelpers.swift */; };
31727423218BB9A50039FFCC /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31727421218BB9A50039FFCC /* TestHelpers.swift */; };
31727424218BB9A50039FFCC /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31727421218BB9A50039FFCC /* TestHelpers.swift */; };
31762DCA247738FA0025C704 /* LeaksTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31762DC9247738FA0025C704 /* LeaksTests.swift */; };
31762DCB247738FA0025C704 /* LeaksTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31762DC9247738FA0025C704 /* LeaksTests.swift */; };
31762DCC247738FA0025C704 /* LeaksTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31762DC9247738FA0025C704 /* LeaksTests.swift */; };
Expand Down Expand Up @@ -389,7 +389,7 @@
316250E51F00ACD000E207A6 /* PULL_REQUEST_TEMPLATE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = PULL_REQUEST_TEMPLATE.md; path = .github/PULL_REQUEST_TEMPLATE.md; sourceTree = "<group>"; };
31727417218BAEC90039FFCC /* HTTPMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPMethod.swift; sourceTree = "<group>"; };
3172741C218BB1790039FFCC /* ParameterEncoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParameterEncoder.swift; sourceTree = "<group>"; };
31727421218BB9A50039FFCC /* HTTPBin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPBin.swift; sourceTree = "<group>"; };
31727421218BB9A50039FFCC /* TestHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestHelpers.swift; sourceTree = "<group>"; };
31762DC9247738FA0025C704 /* LeaksTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeaksTests.swift; sourceTree = "<group>"; };
318DD40E2439780500963291 /* Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Combine.swift; sourceTree = "<group>"; };
3191B5741F5F53A6003960A8 /* Protected.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Protected.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -904,7 +904,7 @@
isa = PBXGroup;
children = (
4C256A501B096C2C0065714F /* BaseTestCase.swift */,
31727421218BB9A50039FFCC /* HTTPBin.swift */,
31727421218BB9A50039FFCC /* TestHelpers.swift */,
31762DC9247738FA0025C704 /* LeaksTests.swift */,
31F9683B20BB70290009606F /* NSLoggingEventMonitor.swift */,
4C256A4E1B09656A0065714F /* Core */,
Expand Down Expand Up @@ -1092,7 +1092,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 1220;
LastUpgradeCheck = 1230;
ORGANIZATIONNAME = Alamofire;
TargetAttributes = {
4CF626EE1BA7CB3E0011A099 = {
Expand Down Expand Up @@ -1358,7 +1358,7 @@
4C7DD7ED224C627300249836 /* Result+Alamofire.swift in Sources */,
3106FB6323F8C53A007FAB43 /* ProtectedTests.swift in Sources */,
4CB0080F2455FE9700C38783 /* AuthenticationInterceptorTests.swift in Sources */,
31727424218BB9A50039FFCC /* HTTPBin.swift in Sources */,
31727424218BB9A50039FFCC /* TestHelpers.swift in Sources */,
311A89C123185BC0003BB714 /* CachedResponseHandlerTests.swift in Sources */,
31EBD9C320D1D89D00D1FF34 /* ValidationTests.swift in Sources */,
3111CE8620A76370008315E2 /* SessionTests.swift in Sources */,
Expand Down Expand Up @@ -1526,7 +1526,7 @@
4C7DD7EB224C627300249836 /* Result+Alamofire.swift in Sources */,
3106FB6123F8C53A007FAB43 /* ProtectedTests.swift in Sources */,
4CB0080D2455FE9700C38783 /* AuthenticationInterceptorTests.swift in Sources */,
31727422218BB9A50039FFCC /* HTTPBin.swift in Sources */,
31727422218BB9A50039FFCC /* TestHelpers.swift in Sources */,
311A89BF23185BBF003BB714 /* CachedResponseHandlerTests.swift in Sources */,
31EBD9C120D1D89C00D1FF34 /* ValidationTests.swift in Sources */,
3111CE8420A7636E008315E2 /* SessionTests.swift in Sources */,
Expand Down Expand Up @@ -1568,7 +1568,7 @@
4C7DD7EC224C627300249836 /* Result+Alamofire.swift in Sources */,
3106FB6223F8C53A007FAB43 /* ProtectedTests.swift in Sources */,
4CB0080E2455FE9700C38783 /* AuthenticationInterceptorTests.swift in Sources */,
31727423218BB9A50039FFCC /* HTTPBin.swift in Sources */,
31727423218BB9A50039FFCC /* TestHelpers.swift in Sources */,
311A89C023185BBF003BB714 /* CachedResponseHandlerTests.swift in Sources */,
31EBD9C220D1D89C00D1FF34 /* ValidationTests.swift in Sources */,
3111CE8520A7636F008315E2 /* SessionTests.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -42,6 +42,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
disableMainThreadChecker = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion Example/iOS Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 1220;
LastUpgradeCheck = 1230;
ORGANIZATIONNAME = Alamofire;
TargetAttributes = {
F8111E0419A951050040E7D1 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1230"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Source/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public class Request {
/// `Progress` of the download of any response data. Reset to `0` if the `Request` is retried.
public let downloadProgress = Progress(totalUnitCount: 0)
/// `ProgressHandler` called when `uploadProgress` is updated, on the provided `DispatchQueue`.
fileprivate var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? {
private var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? {
get { mutableState.uploadProgressHandler }
set { mutableState.uploadProgressHandler = newValue }
}
Expand Down
Loading

0 comments on commit b5dfb35

Please sign in to comment.