Test TLS Version
(t *testing.T)
| 525 | |
| 526 | // Test TLS Version |
| 527 | func TestTLSMinimumVersionSetting(t *testing.T) { |
| 528 | tests := []struct { |
| 529 | name string |
| 530 | tlsString string |
| 531 | expectedTLS uint16 |
| 532 | }{ |
| 533 | { |
| 534 | name: `Set TLS 1.0`, |
| 535 | tlsString: `tlsv1`, |
| 536 | expectedTLS: tls.VersionTLS10, |
| 537 | }, |
| 538 | { |
| 539 | name: `Set TLS 1.1`, |
| 540 | tlsString: `tlsv1.1`, |
| 541 | expectedTLS: tls.VersionTLS11, |
| 542 | }, |
| 543 | { |
| 544 | name: `Set TLS 1.2`, |
| 545 | tlsString: `tlsv1.2`, |
| 546 | expectedTLS: tls.VersionTLS12, |
| 547 | }, |
| 548 | { |
| 549 | name: `No TLS set, should default to 1.0`, |
| 550 | tlsString: ``, |
| 551 | expectedTLS: tls.VersionTLS12, |
| 552 | }, |
| 553 | } |
| 554 | |
| 555 | for _, test := range tests { |
| 556 | t.Run(test.name, func(tt *testing.T) { |
| 557 | assert.Equal(t, test.expectedTLS, GetTLSVersionFromString(&test.tlsString)) |
| 558 | }) |
| 559 | } |
| 560 | |
| 561 | } |
| 562 | |
| 563 | func TestAutoImportEnabled(t *testing.T) { |
| 564 | tests := []struct { |
nothing calls this directly
no test coverage detected