Skip to content

Commit

Permalink
Adding of BDD tests for setup_service_binding_root.erb.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitardimitrov13 committed Jul 22, 2024
1 parent 56f187b commit beb5a62
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 0 additions & 3 deletions jobs/rep/templates/setup_service_binding_root.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ if [ -d "$service_binding_root" ]; then
if mountpoint -q "$service_binding_root"; then
fuser -k "$service_binding_root"
umount -l "$service_binding_root"
echo "Force unmounted $service_binding_root"
fi

sleep 10
Expand All @@ -35,9 +34,7 @@ mkdir -p "$service_binding_root"

# Mount the root tmpfs
if mount -t tmpfs -o size="$root_tmpfs_size" tmpfs "$service_binding_root"; then
echo "Root tmpfs successfully mounted to $service_binding_root with size $root_tmpfs_size."
else
echo "Failed to mount root tmpfs to $service_binding_root."
exit 1
fi

Expand Down
15 changes: 14 additions & 1 deletion spec/rep_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,18 @@
end.to raise_error(/The max_containers prop should be a positive integer/)
end
end
end
end

describe 'setup_service_binding_root.erb' do
let(:template) { job.template('bin/setup_service_binding_root') }

context 'checks the max_containers value' do
it 'raises an error if max_containers is <= 0' do
deployment_manifest_fragment['diego']['rep']['max_containers'] = -10
expect do
rendered_template
end.to raise_error(/The max_containers prop should be a positive integer/)
end
end
end
end

0 comments on commit beb5a62

Please sign in to comment.