HTTP2ClientTransportConfigTests.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright 2024, gRPC Authors All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import GRPCHTTP2Core
  17. import XCTest
  18. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  19. final class HTTP2ClientTransportConfigTests: XCTestCase {
  20. func testCompressionDefaults() {
  21. let config = HTTP2ClientTransport.Config.Compression.defaults
  22. XCTAssertEqual(config.algorithm, .none)
  23. XCTAssertEqual(config.enabledAlgorithms, .none)
  24. }
  25. func testConnectionDefaults() {
  26. let config = HTTP2ClientTransport.Config.Connection.defaults
  27. XCTAssertEqual(config.maxIdleTime, .seconds(30 * 60))
  28. XCTAssertNil(config.keepalive)
  29. }
  30. func testBackoffDefaults() {
  31. let config = HTTP2ClientTransport.Config.Backoff.defaults
  32. XCTAssertEqual(config.initial, .seconds(1))
  33. XCTAssertEqual(config.max, .seconds(120))
  34. XCTAssertEqual(config.multiplier, 1.6)
  35. XCTAssertEqual(config.jitter, 0.2)
  36. }
  37. func testHTTP2Defaults() {
  38. let config = HTTP2ClientTransport.Config.HTTP2.defaults
  39. XCTAssertEqual(config.maxFrameSize, 16384)
  40. XCTAssertEqual(config.targetWindowSize, 8 * 1024 * 1024)
  41. }
  42. }