mirror of https://github.com/helm/helm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.2 KiB
78 lines
2.2 KiB
3 years ago
|
/*
|
||
|
Copyright The Helm 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 registry
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/suite"
|
||
|
)
|
||
|
|
||
1 year ago
|
type InsecureTLSRegistryClientTestSuite struct {
|
||
2 years ago
|
TestSuite
|
||
3 years ago
|
}
|
||
|
|
||
1 year ago
|
func (suite *InsecureTLSRegistryClientTestSuite) SetupSuite() {
|
||
3 years ago
|
// init test client
|
||
1 year ago
|
dockerRegistry := setup(&suite.TestSuite, true, true)
|
||
3 years ago
|
|
||
|
// Start Docker registry
|
||
|
go dockerRegistry.ListenAndServe()
|
||
|
}
|
||
|
|
||
1 year ago
|
func (suite *InsecureTLSRegistryClientTestSuite) TearDownSuite() {
|
||
|
teardown(&suite.TestSuite)
|
||
3 years ago
|
os.RemoveAll(suite.WorkspaceDir)
|
||
|
}
|
||
|
|
||
1 year ago
|
func (suite *InsecureTLSRegistryClientTestSuite) Test_0_Login() {
|
||
3 years ago
|
err := suite.RegistryClient.Login(suite.DockerRegistryHost,
|
||
3 years ago
|
LoginOptBasicAuth("badverybad", "ohsobad"),
|
||
|
LoginOptInsecure(true))
|
||
1 year ago
|
suite.NotNil(err, "error logging into registry with bad credentials")
|
||
3 years ago
|
|
||
3 years ago
|
err = suite.RegistryClient.Login(suite.DockerRegistryHost,
|
||
3 years ago
|
LoginOptBasicAuth(testUsername, testPassword),
|
||
|
LoginOptInsecure(true))
|
||
1 year ago
|
suite.Nil(err, "no error logging into registry with good credentials")
|
||
3 years ago
|
}
|
||
|
|
||
1 year ago
|
func (suite *InsecureTLSRegistryClientTestSuite) Test_1_Push() {
|
||
2 years ago
|
testPush(&suite.TestSuite)
|
||
3 years ago
|
}
|
||
|
|
||
1 year ago
|
func (suite *InsecureTLSRegistryClientTestSuite) Test_2_Pull() {
|
||
2 years ago
|
testPull(&suite.TestSuite)
|
||
3 years ago
|
}
|
||
|
|
||
1 year ago
|
func (suite *InsecureTLSRegistryClientTestSuite) Test_3_Tags() {
|
||
2 years ago
|
testTags(&suite.TestSuite)
|
||
3 years ago
|
}
|
||
|
|
||
1 year ago
|
func (suite *InsecureTLSRegistryClientTestSuite) Test_4_Logout() {
|
||
3 years ago
|
err := suite.RegistryClient.Logout("this-host-aint-real:5000")
|
||
3 years ago
|
suite.NotNil(err, "error logging out of registry that has no entry")
|
||
|
|
||
3 years ago
|
err = suite.RegistryClient.Logout(suite.DockerRegistryHost)
|
||
3 years ago
|
suite.Nil(err, "no error logging out of registry")
|
||
|
}
|
||
|
|
||
1 year ago
|
func TestInsecureTLSRegistryClientTestSuite(t *testing.T) {
|
||
|
suite.Run(t, new(InsecureTLSRegistryClientTestSuite))
|
||
3 years ago
|
}
|