forked from rancher/opni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTiltfile.tests
72 lines (55 loc) · 2.02 KB
/
Tiltfile.tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
load('ext://tests/golang', 'test_go')
bundle = local("curl -fsSL https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.1/bundle.yaml", quiet=True)
k8s_yaml(bundle)
def name(c):
return c['metadata']['name']
def decode(yaml):
resources = decode_yaml_stream(bundle)
# workaround a bug in decode_yaml_stream where it returns duplicates
# This bug has been fixed in Tilt v0.17.3+
filtered = []
names = {}
for r in resources:
if r == None:
continue
n = '%s:%s' % (name(r), r['kind'])
if n in names:
continue
names[n] = True
filtered.append(r)
return filtered
k8s_resource("prometheus-operator", labels="prometheus")
crds = [r for r in decode(bundle) if (r['kind'] == 'CustomResourceDefinition')]
if len(crds):
# Deploy the prometheus CRDs as a separate resource, after the operator is
# available.
k8s_resource(
new_name='prometheus-crds',
objects = [('%s' % name(c)) for c in crds],
resource_deps=['uncategorized', 'prometheus-operator'],
labels="prometheus")
# Wait until the CRDs are ready.
local_resource(
'prometheus-crds-ready',
cmd=' && '.join([('kubectl wait --for=condition=Established crd %s' % name(c)) for c in crds]),
resource_deps=['prometheus-crds'],
labels="prometheus")
k8s_yaml("config/e2e/prometheus-namespace.yaml")
k8s_yaml([
"config/e2e/prometheus.yaml",
"config/e2e/service.yaml"])
k8s_resource(
new_name="prometheus",
objects = [
'test-prometheus:Service',
'test-prometheus:Prometheus',
],
extra_pod_selectors={'prometheus': 'test-prometheus'},
resource_deps=['prometheus-crds-ready'],
labels="prometheus")
test_go('e2e-tests-prod', './test/e2e --ginkgo.label-filter="e2e && !demo"', '.',
extra_args=["-v", "-race"],
trigger_mode=TRIGGER_MODE_MANUAL,
# run this test automatically in CI mode; otherwise, only on manual trigger
auto_init=config.tilt_subcommand == 'ci',
resource_deps=["opni-controller-manager", "prometheus"])