Skip to content

Commit

Permalink
debug test hang
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlocke committed Dec 12, 2023
1 parent 913d554 commit 59edb83
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 25 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ jobs:
run: |
cd TestSwiftyDropbox
pod install --repo-update
- name: Test iOS
env:
FULL_DROPBOX_API_APP_KEY: ${{ secrets.FULL_DROPBOX_API_APP_KEY }}
FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN: ${{ secrets.FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN }}
FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN: ${{ secrets.FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN }}
TEAM_MEMBER_EMAIL: ${{ secrets.TEAM_MEMBER_EMAIL }}
EMAIL_TO_ADD_AS_TEAM_MEMBER: ${{ secrets.EMAIL_TO_ADD_AS_TEAM_MEMBER }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
ACCOUNT_ID_2: ${{ secrets.ACCOUNT_ID_2 }}
ACCOUNT_ID_3: ${{ secrets.ACCOUNT_ID_3 }}
platform: ${{ 'iOS Simulator' }}
device: ${{ 'iPhone 14' }}
run: |
xcodebuild -workspace TestSwiftyDropbox/TestSwiftyDropbox.xcworkspace/ -scheme TestSwiftyDropbox_iOS -sdk iphonesimulator \
-destination "platform=$platform,name=$device" \
FULL_DROPBOX_API_APP_KEY=$FULL_DROPBOX_API_APP_KEY \
FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN=$FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN \
FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN=$FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN \
TEAM_MEMBER_EMAIL=$TEAM_MEMBER_EMAIL \
EMAIL_TO_ADD_AS_TEAM_MEMBER=$EMAIL_TO_ADD_AS_TEAM_MEMBER \
ACCOUNT_ID=$ACCOUNT_ID \
ACCOUNT_ID_2=$ACCOUNT_ID_2 \
ACCOUNT_ID_3=$ACCOUNT_ID_3 \
test
# - name: Test iOS
# env:
# FULL_DROPBOX_API_APP_KEY: ${{ secrets.FULL_DROPBOX_API_APP_KEY }}
# FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN: ${{ secrets.FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN }}
# FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN: ${{ secrets.FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN }}
# TEAM_MEMBER_EMAIL: ${{ secrets.TEAM_MEMBER_EMAIL }}
# EMAIL_TO_ADD_AS_TEAM_MEMBER: ${{ secrets.EMAIL_TO_ADD_AS_TEAM_MEMBER }}
# ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
# ACCOUNT_ID_2: ${{ secrets.ACCOUNT_ID_2 }}
# ACCOUNT_ID_3: ${{ secrets.ACCOUNT_ID_3 }}
# platform: ${{ 'iOS Simulator' }}
# device: ${{ 'iPhone 14' }}
# run: |
# xcodebuild -workspace TestSwiftyDropbox/TestSwiftyDropbox.xcworkspace/ -scheme TestSwiftyDropbox_iOS -sdk iphonesimulator \
# -destination "platform=$platform,name=$device" \
# FULL_DROPBOX_API_APP_KEY=$FULL_DROPBOX_API_APP_KEY \
# FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN=$FULL_DROPBOX_TESTER_TEAM_REFRESH_TOKEN \
# FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN=$FULL_DROPBOX_TESTER_USER_REFRESH_TOKEN \
# TEAM_MEMBER_EMAIL=$TEAM_MEMBER_EMAIL \
# EMAIL_TO_ADD_AS_TEAM_MEMBER=$EMAIL_TO_ADD_AS_TEAM_MEMBER \
# ACCOUNT_ID=$ACCOUNT_ID \
# ACCOUNT_ID_2=$ACCOUNT_ID_2 \
# ACCOUNT_ID_3=$ACCOUNT_ID_3 \
# test

- name: Set up keychain
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class FilesRoutesTests: XCTestCase {
private var tester: DropboxTester!

override func setUp() {
print("[DEBUG CI HANG] setUp start")

// You need an API app with the "Full Dropbox" permission type and at least the scopes in DropboxTester.scopes
// and no team scopes.
// You can create one for testing here: https://www.dropbox.com/developers/apps/create
Expand All @@ -28,15 +30,22 @@ class FilesRoutesTests: XCTestCase {

continueAfterFailure = false

print("[DEBUG CI HANG] setUp 1")
if DropboxClientsManager.authorizedClient == nil {
print("[DEBUG CI HANG] setUp 2")
setupDropboxClientsManager()
}

print("[DEBUG CI HANG] setUp 3")
userClient = DropboxClientsManager.authorizedClient!.users!
print("[DEBUG CI HANG] setUp 4")
tester = DropboxTester()
print("[DEBUG CI HANG] setUp end")
}

func setupDropboxClientsManager() {
print("[DEBUG CI HANG] setupDropboxClientsManager start")

let processInfo = ProcessInfo.processInfo.environment

guard let apiAppKey = processInfo["FULL_DROPBOX_API_APP_KEY"] else {
Expand All @@ -50,11 +59,14 @@ class FilesRoutesTests: XCTestCase {
return XCTFail("Error: Access token creation failed")
}

print("[DEBUG CI HANG] setupDropboxClientsManager token generated")

#if os(OSX)
DropboxClientsManager.setupWithAppKeyDesktop(apiAppKey, transportClient: transportClient)
DropboxClientsManager.setupWithAppKeyDesktop(apiAppKey, transportClient: transportClient) // could be getting here
#elseif os(iOS)
DropboxClientsManager.setupWithAppKey(apiAppKey, transportClient: transportClient)
#endif
print("[DEBUG CI HANG] setupDropboxClientsManager end")
}

override func tearDown() {
Expand All @@ -69,15 +81,23 @@ class FilesRoutesTests: XCTestCase {
}

func testFileRoutes() {
print("[DEBUG CI HANG] testFileRoutes 1")

let flag = XCTestExpectation()

let nextTest = {
flag.fulfill()
}

print("[DEBUG CI HANG] testFileRoutes 2")
tester.testFilesActions(nextTest, asMember: false)

print("[DEBUG CI HANG] testFileRoutes 3")

let result = XCTWaiter.wait(for: [flag], timeout: 60 * 5)
print("[DEBUG CI HANG] testFileRoutes 4")

XCTAssertEqual(result, .completed, "Error: timeout on file routes tests")
print("[DEBUG CI HANG] testFileRoutes 5")
}
}

0 comments on commit 59edb83

Please sign in to comment.