HTTP2ServerTransportConfigTests.swift 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 HTTP2ServerTransportConfigTests: XCTestCase {
  20. func testCompressionDefaults() {
  21. let config = HTTP2ServerTransport.Config.Compression.defaults
  22. XCTAssertEqual(config.enabledAlgorithms, .none)
  23. }
  24. func testKeepaliveDefaults() {
  25. let config = HTTP2ServerTransport.Config.Keepalive.defaults
  26. XCTAssertEqual(config.time, .seconds(7200))
  27. XCTAssertEqual(config.timeout, .seconds(20))
  28. XCTAssertEqual(config.clientBehavior.allowWithoutCalls, false)
  29. XCTAssertEqual(config.clientBehavior.minPingIntervalWithoutCalls, .seconds(300))
  30. }
  31. func testConnectionDefaults() {
  32. let config = HTTP2ServerTransport.Config.Connection.defaults
  33. XCTAssertNil(config.maxAge)
  34. XCTAssertNil(config.maxGraceTime)
  35. XCTAssertNil(config.maxIdleTime)
  36. }
  37. func testHTTP2Defaults() {
  38. let config = HTTP2ServerTransport.Config.HTTP2.defaults
  39. XCTAssertEqual(config.maxFrameSize, 16_384)
  40. XCTAssertEqual(config.targetWindowSize, 65_535)
  41. XCTAssertNil(config.maxConcurrentStreams)
  42. }
  43. func testRPCDefaults() {
  44. let config = HTTP2ServerTransport.Config.RPC.defaults
  45. XCTAssertEqual(config.maxRequestPayloadSize, 4_194_304)
  46. }
  47. }