HTTP2ClientTransportConfigTests.swift 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. final class HTTP2ClientTransportConfigTests: XCTestCase {
  19. func testCompressionDefaults() {
  20. let config = HTTP2ClientTransport.Config.Compression.defaults
  21. XCTAssertEqual(config.algorithm, .none)
  22. XCTAssertEqual(config.enabledAlgorithms, .none)
  23. }
  24. func testIdleDefaults() {
  25. let config = HTTP2ClientTransport.Config.Idle.defaults
  26. XCTAssertEqual(config.maxTime, .seconds(30 * 60))
  27. }
  28. func testBackoffDefaults() {
  29. let config = HTTP2ClientTransport.Config.Backoff.defaults
  30. XCTAssertEqual(config.initial, .seconds(1))
  31. XCTAssertEqual(config.max, .seconds(120))
  32. XCTAssertEqual(config.multiplier, 1.6)
  33. XCTAssertEqual(config.jitter, 0.2)
  34. }
  35. func testHTTP2Defaults() {
  36. let config = HTTP2ClientTransport.Config.HTTP2.defaults
  37. XCTAssertEqual(config.maxFrameSize, 16384)
  38. XCTAssertEqual(config.targetWindowSize, 8 * 1024 * 1024)
  39. }
  40. }