Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Add resources to InitContainers #40

Merged
merged 4 commits into from
Jan 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add tests for initcontainer resources
  • Loading branch information
Pete Brown committed Jan 25, 2019
commit 6717f56908a924d4469c5747390bf5fbea392af2
33 changes: 27 additions & 6 deletions elasticsearch/tests/elasticsearch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_overriding_the_image_and_tag():
def test_use_discovery_hosts_if_not_master():
config = '''
masterService: "hostservice"
roles:
roles:
master: "false"
'''
r = helm_template(config)
Expand All @@ -207,7 +207,7 @@ def test_use_discovery_hosts_if_not_master():
def test_set_initial_master_nodes_when_using_v_7():
config = '''
esMajorVersion: 7
roles:
roles:
master: "true"
'''
r = helm_template(config)
Expand All @@ -225,7 +225,7 @@ def test_set_initial_master_nodes_when_using_v_7():
def test_dont_set_initial_master_nodes_if_not_master_when_using_es_version_7():
config = '''
esMajorVersion: 7
roles:
roles:
master: "false"
'''
r = helm_template(config)
Expand All @@ -247,7 +247,7 @@ def test_enabling_machine_learning_role():

def test_adding_extra_env_vars():
config = '''
extraEnvs:
extraEnvs:
- name: hello
value: world
'''
Expand Down Expand Up @@ -324,6 +324,29 @@ def test_adding_a_node_selector():
r = helm_template(config)
assert r['statefulset'][uname]['spec']['template']['spec']['nodeSelector']['disktype'] == 'ssd'

def test_adding_resources_to_initcontainer():
config = '''
initResources:
limits:
cpu: "25m"
memory: "128Mi"
requests:
cpu: "25m"
memory: "128Mi"
'''
r = helm_template(config)
i = r['statefulset'][uname]['spec']['template']['spec']['initContainers'][0]

assert i['resources'] == {
'requests': {
'cpu': '25m',
'memory': '128Mi'
},
'limits': {
'cpu': '25m',
'memory': '128Mi'
}
}

def test_adding_an_ingress_rule():
config = '''
Expand Down Expand Up @@ -389,5 +412,3 @@ def test_adding_in_es_config():
assert {'mountPath': '/usr/share/elasticsearch/config/log4j2.properties', 'name': 'esconfig', 'subPath': 'log4j2.properties'} in s['containers'][0]['volumeMounts']

assert 'configchecksum' in r['statefulset'][uname]['spec']['template']['metadata']['annotations']