-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose max concurrent connection config option
This adds an option to set the maximum number of concurrent connections to vCenter that will be used by the port layer. This does NOT effect the admin server, and admin server connections do not count towards the maximum for the port layer. This adds a --max-concurrent-connections (--mcc short form) option to create and configure, allowing setting between 2 (because port layer requires 2 minimum to initialize) and 255 (because it's a sane upper limit, given default has been 32 since 2017, but with no reason beyond that). This has NOT made the necessary changes for this option to be available via the VIC LCM API and vCenter UI extension. Testing so far has been via manual use of CLI.
- Loading branch information
Showing
12 changed files
with
248 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
// Copyright 2016-2018 VMware, Inc. All Rights Reserved. | ||
// | ||
// 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 executor | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetEnv(t *testing.T) { | ||
sess := SessionConfig{ | ||
Cmd: Cmd{ | ||
Env: []string{ | ||
"hello=world", | ||
"goodbye=", | ||
}, | ||
}, | ||
} | ||
|
||
assert.Equal(t, "world", *sess.GetEnv("hello"), "Get on set variable should return set value") | ||
assert.Equal(t, "", *sess.GetEnv("goodbye"), "Get on set variable with empty value should return empty string") | ||
assert.Nil(t, sess.GetEnv("nope"), "Get on an unset variable should return nil") | ||
} | ||
|
||
func TestSetEnvUpdateValue(t *testing.T) { | ||
sess := SessionConfig{ | ||
Cmd: Cmd{ | ||
Env: []string{ | ||
"hello=world", | ||
"goodbye=", | ||
}, | ||
}, | ||
} | ||
|
||
require.Equal(t, "world", *sess.GetEnv("hello"), "Get on set variable should return set value") | ||
require.Equal(t, "", *sess.GetEnv("goodbye"), "Get on set variable with empty value should return empty string") | ||
|
||
newVal := "sapients" | ||
old := *sess.SetEnv("hello", newVal) | ||
|
||
assert.Equal(t, "world", old, "Expected old value to be return on update") | ||
assert.Equal(t, newVal, *sess.GetEnv("hello"), "Expected new value to be updated value") | ||
|
||
assert.Equal(t, "", *sess.GetEnv("goodbye"), "Expected unmodified value not to have changed") | ||
} | ||
|
||
func TestSetEnvEmptyValue(t *testing.T) { | ||
sess := SessionConfig{ | ||
Cmd: Cmd{ | ||
Env: []string{ | ||
"hello=world", | ||
"goodbye=", | ||
}, | ||
}, | ||
} | ||
|
||
require.Equal(t, "world", *sess.GetEnv("hello"), "Get on set variable should return set value") | ||
require.Equal(t, "", *sess.GetEnv("goodbye"), "Get on set variable with empty value should return empty string") | ||
|
||
newVal := "sapients" | ||
old := *sess.SetEnv("goodbye", newVal) | ||
|
||
assert.Equal(t, "", old, "Expected old value to be return on update") | ||
assert.Equal(t, newVal, *sess.GetEnv("goodbye"), "Expected new value to be updated value") | ||
|
||
assert.Equal(t, "world", *sess.GetEnv("hello"), "Expected unmodified value not to have changed") | ||
} | ||
|
||
func TestSetEnvNewEnv(t *testing.T) { | ||
sess := SessionConfig{ | ||
Cmd: Cmd{ | ||
Env: []string{ | ||
"hello=world", | ||
"goodbye=", | ||
}, | ||
}, | ||
} | ||
|
||
require.Equal(t, "world", *sess.GetEnv("hello"), "Get on set variable should return set value") | ||
require.Equal(t, "", *sess.GetEnv("goodbye"), "Get on set variable with empty value should return empty string") | ||
|
||
newKey := "solo" | ||
require.Nil(t, sess.GetEnv(newKey), "Expected nil return for unset value") | ||
|
||
// checking we can set a new env with value of empty string | ||
newVal := "" | ||
_ = sess.SetEnv(newKey, newVal) | ||
assert.Equal(t, newVal, *sess.GetEnv(newKey), "Expected new value to be updated value") | ||
|
||
// checking we can set a new env with value specified | ||
newKey = "absence" | ||
newVal = "fonder" | ||
|
||
_ = sess.SetEnv(newKey, newVal) | ||
assert.Equal(t, newVal, *sess.GetEnv(newKey), "Expected new value to be updated value") | ||
|
||
assert.Equal(t, "world", *sess.GetEnv("hello"), "Expected unmodified value not to have changed") | ||
assert.Equal(t, "", *sess.GetEnv("goodbye"), "Expected unmodified value not to have changed") | ||
} |
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
Oops, something went wrong.