Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Chu Peng 楚鹏
minikube
提交
0bfee479
M
minikube
项目概览
Chu Peng 楚鹏
/
minikube
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
minikube
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0bfee479
编写于
3月 24, 2021
作者:
S
Sharif Elgamal
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add integration test for pulling private image
上级
63b43cc6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
10 deletion
+40
-10
test/integration/addons_test.go
test/integration/addons_test.go
+28
-10
test/integration/testdata/private-image.yaml
test/integration/testdata/private-image.yaml
+12
-0
未找到文件。
test/integration/addons_test.go
浏览文件 @
0bfee479
...
...
@@ -46,17 +46,20 @@ func TestAddons(t *testing.T) {
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
Minutes
(
40
))
defer
Cleanup
(
t
,
profile
,
cancel
)
// Set an env var to point to our dummy credentials file
err
:=
os
.
Setenv
(
"GOOGLE_APPLICATION_CREDENTIALS"
,
filepath
.
Join
(
*
testdataDir
,
"gcp-creds.json"
))
defer
os
.
Unsetenv
(
"GOOGLE_APPLICATION_CREDENTIALS"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed setting GOOGLE_APPLICATION_CREDENTIALS env var: %v"
,
err
)
}
// We don't need a dummy file is we're on GCE
if
!
detect
.
IsOnGCE
()
{
// Set an env var to point to our dummy credentials file
err
:=
os
.
Setenv
(
"GOOGLE_APPLICATION_CREDENTIALS"
,
filepath
.
Join
(
*
testdataDir
,
"gcp-creds.json"
))
defer
os
.
Unsetenv
(
"GOOGLE_APPLICATION_CREDENTIALS"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed setting GOOGLE_APPLICATION_CREDENTIALS env var: %v"
,
err
)
}
err
=
os
.
Setenv
(
"GOOGLE_CLOUD_PROJECT"
,
"this_is_fake"
)
defer
os
.
Unsetenv
(
"GOOGLE_CLOUD_PROJECT"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed setting GOOGLE_CLOUD_PROJECT env var: %v"
,
err
)
err
=
os
.
Setenv
(
"GOOGLE_CLOUD_PROJECT"
,
"this_is_fake"
)
defer
os
.
Unsetenv
(
"GOOGLE_CLOUD_PROJECT"
)
if
err
!=
nil
{
t
.
Fatalf
(
"Failed setting GOOGLE_CLOUD_PROJECT env var: %v"
,
err
)
}
}
args
:=
append
([]
string
{
"start"
,
"-p"
,
profile
,
"--wait=true"
,
"--memory=4000"
,
"--alsologtostderr"
,
"--addons=registry"
,
"--addons=metrics-server"
,
"--addons=olm"
,
"--addons=volumesnapshots"
,
"--addons=csi-hostpath-driver"
},
StartArgs
()
...
)
...
...
@@ -618,6 +621,21 @@ func validateGCPAuthAddon(ctx context.Context, t *testing.T, profile string) {
t
.
Errorf
(
"'printenv GOOGLE_APPLICATION_CREDENTIALS' returned %s, expected %s"
,
got
,
expected
)
}
// If we're on GCE, we have proper credentials and can test the registry secrets with an artifact registry image
if
detect
.
IsOnGCE
()
{
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
"kubectl"
,
"--context"
,
profile
,
"apply"
,
"-f"
,
filepath
.
Join
(
*
testdataDir
,
"private-image.yaml"
)))
if
err
!=
nil
{
t
.
Fatalf
(
"print env project: %v"
,
err
)
}
// Make sure the pod is up and running, which means we successfully pulled the private image down
// 8 minutes, because 4 is not enough for images to pull in all cases.
_
,
err
:=
PodWait
(
ctx
,
t
,
profile
,
"default"
,
"integration-test=private-image"
,
Minutes
(
8
))
if
err
!=
nil
{
t
.
Fatalf
(
"wait for private image: %v"
,
err
)
}
}
rr
,
err
=
Run
(
t
,
exec
.
CommandContext
(
ctx
,
Target
(),
"-p"
,
profile
,
"addons"
,
"disable"
,
"gcp-auth"
,
"--alsologtostderr"
,
"-v=1"
))
if
err
!=
nil
{
t
.
Errorf
(
"failed disabling gcp-auth addon. arg %q.s %v"
,
rr
.
Command
(),
err
)
...
...
test/integration/testdata/private-image.yaml
0 → 100644
浏览文件 @
0bfee479
apiVersion
:
v1
kind
:
Deployment
metadata
:
name
:
private-image
labels
:
integration-test
:
private-image
spec
:
containers
:
-
image
:
imagePullPolicy
:
IfNotPresent
name
:
private-image
restartPolicy
:
Always
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录