Skip to content
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

Test failures in ImageDownloaderTests — Semaphore timed out #1327

Closed
1ec5 opened this issue Apr 23, 2018 · 3 comments
Closed

Test failures in ImageDownloaderTests — Semaphore timed out #1327

1ec5 opened this issue Apr 23, 2018 · 3 comments
Assignees

Comments

@1ec5
Copy link
Contributor

1ec5 commented Apr 23, 2018

This Bitrise build for #1076 experienced a slew of test failures related to semaphores in the image downloader tests:

Test failures

MapboxNavigationTests.ImageDownloaderTests
testDownloadingAnImage, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/ImageDownloaderTests.swift:49

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")

testDownloadingImageAgainAfterFirstDownloadCompletes, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/ImageDownloaderTests.swift:95

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testDownloadingSameImageWhileInProgressAddsCallbacksWithoutAddingAnotherRequest, failed - Timeout occurred on runUntil(condition:pollingInterval:until:)
/Users/vagrant/git/MapboxNavigationTests/ImageDownloaderTests.swift:118

      guard (timeout >= DispatchTime.now()) else {
          XCTFail("Timeout occurred on \(#function)")
          return

MapboxNavigationTests.ImageRepositoryTests
test_imageWithURL_downloadsImageWhenNotCached, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/ImageRepositoryTests.swift:27

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
  }

test_imageWithURL_prefersCachedImageWhenAvailable, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/ImageRepositoryTests.swift:27

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
  }

MapboxNavigationTests.InstructionsBannerViewIntegrationTests
testDelimiterDisappearsOnlyWhenAllShieldsHaveLoaded, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewIntegrationTests.swift:51

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
  }

testDelimiterIsHiddenWhenAllShieldsAreAlreadyLoaded, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewIntegrationTests.swift:51

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
  }

testDelimiterIsHiddenWhenAllShieldsAreAlreadyLoaded, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewIntegrationTests.swift:51

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
  }

testDelimiterIsShownWhenShieldsNotLoaded, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewIntegrationTests.swift:51

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
  }

testExitBannerIntegration, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewIntegrationTests.swift:51

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
  }

MapboxNavigationTests.InstructionsBannerViewSnapshotTests
testAbbreviateInstructions, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testAbbreviateInstructionsIncludingDelimiter, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testAbbreviateWestFremontAvenue, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testAdjacentShields, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testExitShields, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testInstructionsAndNextInstructions, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testLongDistance, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testMultilinePrimary, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testPrimaryShieldAndSecondary, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testSinglelinePrimary, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testSinglelinePrimaryAndSecondary, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testSweEngLongDistance, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      

testUkrainianLongDistance, XCTAssertTrue failed - Semaphore timed out
/Users/vagrant/git/MapboxNavigationTests/InstructionsBannerViewSnapshotTests.swift:32

      let semaphoreResult = semaphore.wait(timeout: XCTestCase.NavigationTests.timeout)
      XCTAssert(semaphoreResult == .success, "Semaphore timed out")
      
 Executed 48 tests, with 23 failures (0 unexpected) in 12.279 (12.406) seconds

/ref #1311
/cc @akitchen @JThramer

@akitchen
Copy link
Contributor

Something doesn't seem to add up here. How could we have so many timeouts logged within a test run of ~12 seconds?

We should try .distantFuture as the deadline on CI and see what really happens -- is this an unanticipated call order or is Circle somehow strongly deprioritizing work that happens off the main thread? Are the deadline DispatchTimes somehow being calculated too early?

@akitchen akitchen self-assigned this Apr 23, 2018
akitchen pushed a commit that referenced this issue Apr 23, 2018
... in an attempt at troubleshooting [#1327]
@akitchen
Copy link
Contributor

As I said to @JThramer just now, we declare a static let, which is calculated once and memoized. But time keeps on ticking, as the song goes, so this value needs to either be .distantFuture or calculated, ahem, just in time.

@JThramer
Copy link
Contributor

Did I do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants