Skip to content

Commit

Permalink
Update unit tests to work with latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock committed Mar 19, 2021
1 parent b2b83ef commit 321e17d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
29 changes: 29 additions & 0 deletions spec/fixtures/output/k8s/pod_yml_subpath_configmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,20 @@ spec:
imagePullPolicy: IfNotPresent
workingDir: "/my/home"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: USER
value: "testuser"
- name: UID
value: "1001"
- name: HOME
value: "/my/home"
- name: GROUP
value: "testgroup"
- name: GID
value: "1002"
- name: PATH
value: "/usr/bin:/usr/local/bin"
command:
Expand Down Expand Up @@ -60,6 +72,23 @@ spec:
initContainers:
- name: "init-1"
image: "busybox:latest"
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: USER
value: "testuser"
- name: UID
value: "1001"
- name: HOME
value: "/my/home"
- name: GROUP
value: "testgroup"
- name: GID
value: "1002"
- name: PATH
value: "/usr/bin:/usr/local/bin"
command:
- "/bin/ls"
- "-lrt"
Expand Down
18 changes: 6 additions & 12 deletions spec/job/adapters/kubernetes/batch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -450,16 +450,10 @@ def build_script(opts = {})
image: 'ruby:2.5',
command: 'rake spec',
port: 8080,
env: [
{
name: 'HOME',
value: '/my/home'
},
{
name: 'PATH',
value: '/usr/bin:/usr/local/bin'
}
],
env: {
HOME: '/my/home',
PATH: '/usr/bin:/usr/local/bin'
},
memory: '6Gi',
cpu: '4',
working_dir: '/my/home',
Expand Down Expand Up @@ -495,8 +489,8 @@ def build_script(opts = {})

allow(@basic_batch).to receive(:generate_id).with('rspec-test').and_return('rspec-test-123')
allow(@basic_batch).to receive(:username).and_return('testuser')
allow(@basic_batch).to receive(:run_as_user).and_return(1001)
allow(@basic_batch).to receive(:run_as_group).and_return(1002)
allow(@basic_batch).to receive(:user).and_return(User.new(dir: '/home/testuser', uid: 1001, gid: 1002))
allow(@basic_batch).to receive(:group).and_return('testgroup')

# make sure it get's templated right, also helpful in debugging bc
# it'll show a better diff than the test below.
Expand Down

0 comments on commit 321e17d

Please sign in to comment.