This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
agent: add setProxy/getAgentURL interface
Callers can use setProxy to ask agent to use an existing proxy. agent is modified to rely on its state.URL to tell if an its proxy is a valid one. And startProxy will skip a valid proxy since it is already started. Signed-off-by: Peng Tao <[email protected]>
- Loading branch information
Showing
9 changed files
with
253 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2018 HyperHQ Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
package virtcontainers | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestKataBuiltinProxy(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
p := kataBuiltInProxy{} | ||
|
||
params := proxyParams{} | ||
|
||
err := p.validateParams(params) | ||
assert.NotNil(err) | ||
|
||
params.id = "foobarproxy" | ||
err = p.validateParams(params) | ||
assert.NotNil(err) | ||
|
||
params.agentURL = "foobaragent" | ||
err = p.validateParams(params) | ||
assert.NotNil(err) | ||
|
||
params.consoleURL = "foobarconsole" | ||
err = p.validateParams(params) | ||
assert.NotNil(err) | ||
|
||
params.logger = logrus.WithField("proxy", params.id) | ||
err = p.validateParams(params) | ||
assert.Nil(err) | ||
|
||
buildinProxyConsoleProto = "foobarproto" | ||
_, _, err = p.start(params) | ||
assert.NotNil(err) | ||
assert.Empty(p.sandboxID) | ||
|
||
err = p.stop(0) | ||
assert.Nil(err) | ||
|
||
assert.False(p.consoleWatched()) | ||
} |
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