|
658 | 658 | 'applications' => [ |
659 | 659 | { 'name' => app1_model.name, |
660 | 660 | 'routes' => [ |
661 | | - { 'route' => "https://round-robin-app.#{shared_domain.name}", |
| 661 | + { 'route' => "https://#{route.host}.#{shared_domain.name}", |
662 | 662 | 'options' => { |
663 | 663 | 'loadbalancing' => 'round-robin' |
664 | 664 | } } |
|
683 | 683 | 'applications' => [ |
684 | 684 | { 'name' => app1_model.name, |
685 | 685 | 'routes' => [ |
686 | | - { 'route' => "https://round-robin-app.#{shared_domain.name}", |
| 686 | + { 'route' => "https://#{route.host}.#{shared_domain.name}", |
687 | 687 | 'options' => { |
688 | 688 | 'loadbalancing' => 'least-connections' |
689 | 689 | } } |
|
707 | 707 | 'applications' => [ |
708 | 708 | { 'name' => app1_model.name, |
709 | 709 | 'routes' => [ |
710 | | - { 'route' => "https://round-robin-app.#{shared_domain.name}" } |
| 710 | + { 'route' => "https://#{route.host}.#{shared_domain.name}" } |
711 | 711 | ] } |
712 | 712 | ] |
713 | 713 | }.to_yaml |
|
724 | 724 | expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
725 | 725 | end |
726 | 726 |
|
727 | | - it 'does not modify any route options options: nil is provided' do |
| 727 | + it 'returns 422 when options: null is provided' do |
728 | 728 | yml_manifest = { |
729 | 729 | 'applications' => [ |
730 | 730 | { 'name' => app1_model.name, |
731 | 731 | 'routes' => [ |
732 | | - { 'route' => "https://round-robin-app.#{shared_domain.name}", |
| 732 | + { 'route' => "https://#{route.host}.#{shared_domain.name}", |
733 | 733 | 'options' => nil } |
734 | 734 | ] } |
735 | 735 | ] |
|
738 | 738 | # apply the manifest with the route option |
739 | 739 | post "/v3/spaces/#{space.guid}/actions/apply_manifest", yml_manifest, yml_headers(user_header) |
740 | 740 |
|
741 | | - expect(last_response.status).to eq(202) |
742 | | - job_guid = VCAP::CloudController::PollableJobModel.last.guid |
| 741 | + expect(last_response.status).to eq(422) |
| 742 | + expect(last_response).to have_error_message("For application '#{app1_model.name}': \ |
| 743 | +Route 'https://#{route.host}.#{route.domain.name}': options must be an object") |
743 | 744 |
|
| 745 | + job_guid = VCAP::CloudController::PollableJobModel.last.guid |
744 | 746 | Delayed::Worker.new.work_off |
745 | 747 | expect(VCAP::CloudController::PollableJobModel.find(guid: job_guid)).to be_complete, VCAP::CloudController::PollableJobModel.find(guid: job_guid).cf_api_error |
746 | 748 | app1_model.reload |
|
752 | 754 | 'applications' => [ |
753 | 755 | { 'name' => app1_model.name, |
754 | 756 | 'routes' => [ |
755 | | - { 'route' => "https://round-robin-app.#{shared_domain.name}", |
| 757 | + { 'route' => "https://#{route.host}.#{shared_domain.name}", |
756 | 758 | 'options' => {} } |
757 | 759 | ] } |
758 | 760 | ] |
|
767 | 769 | expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
768 | 770 | end |
769 | 771 |
|
770 | | - it 'does not modify any option when options: { key: nil } is provided' do |
| 772 | + it 'returns 422 when { loadbalancing: null } is provided' do |
771 | 773 | yml_manifest = { |
772 | 774 | 'applications' => [ |
773 | 775 | { 'name' => app1_model.name, |
774 | 776 | 'routes' => [ |
775 | | - { 'route' => "https://round-robin-app.#{shared_domain.name}", |
| 777 | + { 'route' => "https://#{route.host}.#{shared_domain.name}", |
776 | 778 | 'options' => { |
777 | 779 | 'loadbalancing' => nil |
778 | 780 | } } |
|
783 | 785 | # apply the manifest with the route option |
784 | 786 | post "/v3/spaces/#{space.guid}/actions/apply_manifest", yml_manifest, yml_headers(user_header) |
785 | 787 |
|
786 | | - expect(last_response.status).to eq(202) |
| 788 | + expect(last_response.status).to eq(422) |
| 789 | + expect(last_response).to have_error_message("For application '#{app1_model.name}': \ |
| 790 | +Invalid value for 'loadbalancing' for Route 'https://#{route.host}.#{route.domain.name}'; Valid values are: 'round-robin, least-connections'") |
787 | 791 |
|
788 | 792 | app1_model.reload |
789 | 793 | expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
|
813 | 817 |
|
814 | 818 | expect(last_response).to have_status_code(422) |
815 | 819 | expect(last_response).to have_error_message("For application '#{app1_model.name}': \ |
816 | | -Route 'https://#{route.host}.#{route.domain.name}' contains invalid load-balancing algorithm 'unsupported-lb-algorithm'. Valid algorithms: 'round-robin, least-connections'") |
| 820 | +Cannot use loadbalancing value 'unsupported-lb-algorithm' for Route 'https://#{route.host}.#{route.domain.name}'; Valid values are: 'round-robin, least-connections'") |
817 | 821 | end |
818 | 822 | end |
819 | 823 |
|
|
823 | 827 | 'applications' => [ |
824 | 828 | { 'name' => app1_model.name, |
825 | 829 | 'routes' => [ |
826 | | - { 'route' => "https://round-robin-app.#{shared_domain.name}", |
| 830 | + { 'route' => "https://#{route.host}.#{shared_domain.name}", |
827 | 831 | 'options' => { |
828 | 832 | 'loadbalancing' => 'round-robin' |
829 | 833 | } } |
|
0 commit comments