-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OFSwitch connection check to Agent's liveness probes
This helps automatic recovery if some issues cause OFSwitch reconnection to not work properly. It also fixes a race condition between the IsConnected and SwitchConnected methods of OFBridge and makes necessary changes to the constructor of APIServer to allow testing. For #4092 Signed-off-by: Quan Tian <qtian@vmware.com>
- Loading branch information
Showing
14 changed files
with
444 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright 2022 Antrea Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
agentconfig "antrea.io/antrea/pkg/config/agent" | ||
) | ||
|
||
func TestOptionsValidateTLSOptions(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
config *agentconfig.AgentConfig | ||
expectedErr string | ||
}{ | ||
{ | ||
name: "empty input", | ||
config: &agentconfig.AgentConfig{ | ||
TLSCipherSuites: "", | ||
TLSMinVersion: "", | ||
}, | ||
expectedErr: "", | ||
}, | ||
{ | ||
name: "invalid TLSMinVersion", | ||
config: &agentconfig.AgentConfig{ | ||
TLSCipherSuites: "", | ||
TLSMinVersion: "foo", | ||
}, | ||
expectedErr: "invalid TLSMinVersion", | ||
}, | ||
{ | ||
name: "invalid TLSCipherSuites", | ||
config: &agentconfig.AgentConfig{ | ||
TLSCipherSuites: "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, foo", | ||
TLSMinVersion: "VersionTLS10", | ||
}, | ||
expectedErr: "invalid TLSCipherSuites", | ||
}, | ||
{ | ||
name: "valid input", | ||
config: &agentconfig.AgentConfig{ | ||
TLSCipherSuites: "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, TLS_RSA_WITH_AES_128_GCM_SHA256", | ||
TLSMinVersion: "VersionTLS12", | ||
}, | ||
expectedErr: "", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
o := &Options{config: tt.config} | ||
err := o.validateTLSOptions() | ||
if tt.expectedErr == "" { | ||
assert.NoError(t, err) | ||
} else { | ||
assert.ErrorContains(t, err, tt.expectedErr) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.