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

testing - run tests against amnon's cluster DO NOT MERGE #1975

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
env:
LC_CTYPE: en_US.UTF-8
LANG: en_US.UTF-8
ABLY_ENV: sandbox
ABLY_ENV: amnon-dev

steps:
- name: Checkout repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
env:
LC_CTYPE: en_US.UTF-8
LANG: en_US.UTF-8
ABLY_ENV: sandbox
ABLY_ENV: amnon-dev

steps:
- name: Check out repo
Expand Down
2 changes: 1 addition & 1 deletion Examples/Tests/TestsTests/TestsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
var responseData: Data?

let postAppExpectation = self.expectation(description: "POST app to sandbox")
let request = NSMutableURLRequest(url: URL(string: "https://sandbox-rest.ably.io:443/apps")!)
let request = NSMutableURLRequest(url: URL(string: "https://amnon-dev-rest-admin.ably.io:443/apps")!)
request.httpMethod = "POST"
request.httpBody = "{\"keys\":[{}]}".data(using: String.Encoding.utf8)
request.allHTTPHeaderFields = [
Expand All @@ -42,7 +42,7 @@
.flatMap({ $0[0] as? NSDictionary })
.flatMap({ $0["keyStr"] as? NSString })
else {
XCTFail("Expected key in response data, got: \(String(describing: responseData))")

Check failure on line 45 in Examples/Tests/TestsTests/TestsTests.swift

View workflow job for this annotation

GitHub Actions / check

testAblyWorks, failed - Expected key in response data, got: Optional(22403 bytes)
return
}

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ submodules:

## [Tests] Run tests on iOS 14.4 using sandbox environment
test_iOS:
ABLY_ENV="sandbox" NAME="ably-iOS" bundle exec fastlane test_iOS16_2
ABLY_ENV="amnon-dev" NAME="ably-iOS" bundle exec fastlane test_iOS16_2

## [Tests] Run tests on tvOS 14.3 using sandbox environment
test_tvOS:
ABLY_ENV="sandbox" NAME="ably-tvOS" bundle exec fastlane test_tvOS16_1
ABLY_ENV="amnon-dev" NAME="ably-tvOS" bundle exec fastlane test_tvOS16_1

## [Tests] Run tests on macOS using sandbox environment
test_macOS:
ABLY_ENV="sandbox" NAME="ably-macOS" bundle exec fastlane test_macOS
ABLY_ENV="amnon-dev" NAME="ably-macOS" bundle exec fastlane test_macOS

## -- CocoaPods --

Expand Down
4 changes: 2 additions & 2 deletions Scripts/log-environment-information.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ set -e
ip=$(curl -s https://api.ipify.org)
echo "Public IP address is: $ip"

echo "Output of \`dig sandbox-realtime.ably.io\`:"
dig sandbox-realtime.ably.io
echo "Output of \`dig amnon-dev-realtime.ably.io\`:"
dig amnon-dev-realtime.ably.io
2 changes: 1 addition & 1 deletion Test/Test Utilities/TestUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ public func delay(_ seconds: TimeInterval, closure: @escaping () -> Void) {
public func getEnvironment() -> String {
let b = Bundle(for: AblyTests.self)
guard let env = b.infoDictionary!["ABLY_ENV"] as? String, env.count > 0 else {
return "sandbox"
return "amnon-dev"
}
return env
}
Expand Down
1 change: 0 additions & 1 deletion Test/Tests/AuthTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4159,7 +4159,6 @@ class AuthTests: XCTestCase {
client.connection.once(.connected) { stateChange in
client.connection.once(.disconnected) { stateChange in
XCTAssertEqual(stateChange.reason?.code, ARTErrorCode.tokenExpired.intValue)
expect(stateChange.reason?.description).to(contain("Key/token status changed (expire)"))
done()
}
}
Expand Down
10 changes: 8 additions & 2 deletions Test/Tests/RealtimeClientConnectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,7 @@ class RealtimeClientConnectionTests: XCTestCase {
let test = Test()
let options = try AblyTests.commonAppSetup(for: test)
options.autoConnect = false
options.logLevel = .debug;
options.testOptions.transportFactory = TestProxyTransportFactory()
let tokenTtl = 3.0
let tokenDetails = try getTestTokenDetails(for: test, key: options.key, capability: nil, ttl: tokenTtl)
Expand Down Expand Up @@ -2136,6 +2137,7 @@ class RealtimeClientConnectionTests: XCTestCase {
let test = Test()
let options = try AblyTests.clientOptions(for: test)
options.autoConnect = false
options.logLevel = .debug;
let tokenTtl = 1.0
options.token = try getTestToken(for: test, ttl: tokenTtl)
options.testOptions.transportFactory = TestProxyTransportFactory()
Expand All @@ -2146,7 +2148,7 @@ class RealtimeClientConnectionTests: XCTestCase {
done()
}
}

let client = ARTRealtime(options: options)
defer {
client.dispose()
Expand All @@ -2159,6 +2161,8 @@ class RealtimeClientConnectionTests: XCTestCase {
client.connection.on { stateChange in
let state = stateChange.current
let errorInfo = stateChange.reason
print("got state change state: \(stateChange.current)")
print(stateChange.current)
switch state {
case .connected:
fail("Should not be connected")
Expand All @@ -2167,6 +2171,7 @@ class RealtimeClientConnectionTests: XCTestCase {
guard let errorInfo = errorInfo else {
fail("ErrorInfo is nil"); done(); return
}
print("got errorInfo.code=\(errorInfo.code)")
XCTAssertEqual(errorInfo.code, ARTErrorCode.tokenExpired.intValue)
done()
default:
Expand All @@ -2179,8 +2184,9 @@ class RealtimeClientConnectionTests: XCTestCase {

let failures = transport.protocolMessagesReceived.filter { $0.action == .error }

print("failures.count=\(failures.count)")
if failures.count != 1 {
fail("Should have only one connection request fail")
fail("Should have only one connection request fail, got \(failures.count)")
return
}

Expand Down
4 changes: 2 additions & 2 deletions Test/Tests/RestClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1310,9 +1310,9 @@ class RestClientTests: XCTestCase {

// RSC15i
func test__066__RestClient__Host_Fallback__retry_hosts_in_random_order__environment_fallback_hosts_have_the_format__environment___a_e__fallback_ably_realtime_com() {
let environmentFallbackHosts = ARTDefault.fallbackHosts(withEnvironment: "sandbox")
let environmentFallbackHosts = ARTDefault.fallbackHosts(withEnvironment: "amnon-dev")
environmentFallbackHosts.forEach { host in
expect(host).to(match("sandbox-[a-e]-fallback.ably-realtime.com"))
expect(host).to(match("amnon-dev-[a-e]-fallback.ably-realtime.com"))
}
XCTAssertEqual(environmentFallbackHosts.count, 5)
}
Expand Down
4 changes: 2 additions & 2 deletions Test/Tests/RestPaginatedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import XCTest

private let links = "<./messages?start=0&end=1535035746063&limit=100&direction=backwards&format=msgpack&firstEnd=1535035746063&fromDate=1535035746063&mode=all>; rel=\"first\", <./messages?start=0&end=1535035746063&limit=100&direction=backwards&format=msgpack&firstEnd=1535035746063&fromDate=1535035746063&mode=all>; rel=\"current\""

private let url = URL(string: "https://sandbox-rest.ably.io:443/channels/foo/messages?limit=100&direction=backwards")!
private let url = URL(string: "https://amnon-dev-rest.ably.io:443/channels/foo/messages?limit=100&direction=backwards")!

class RestPaginatedTests: XCTestCase {
// XCTest invokes this method before executing the first test in the test suite. We use it to ensure that the global variables are initialized at the same moment, and in the same order, as they would have been when we used the Quick testing framework.
Expand Down Expand Up @@ -44,6 +44,6 @@ class RestPaginatedTests: XCTestCase {
fail("First link isn't a valid URL"); return
}

XCTAssertEqual(firstRequest.url?.absoluteString, "https://sandbox-rest.ably.io:443/channels/foo/messages?start=0&end=1535035746063&limit=100&direction=backwards&format=msgpack&firstEnd=1535035746063&fromDate=1535035746063&mode=all")
XCTAssertEqual(firstRequest.url?.absoluteString, "https://amnon-dev-rest.ably.io:443/channels/foo/messages?start=0&end=1535035746063&limit=100&direction=backwards&format=msgpack&firstEnd=1535035746063&fromDate=1535035746063&mode=all")
}
}
Loading