|
647 | 647 |
|
648 | 648 | expect(last_response).to have_status_code(422) |
649 | 649 | expect(last_response).to have_error_message("For application '#{app1_model.name}': \ |
650 | | -Route 'https://#{route.host}.#{route.domain.name}' contains invalid route option 'doesnt-exist'. Valid keys: 'loadbalancing-algorithm'") |
| 650 | +Route 'https://#{route.host}.#{route.domain.name}' contains invalid route option 'doesnt-exist'. Valid keys: 'loadbalancing'") |
651 | 651 | end |
652 | 652 | end |
653 | 653 |
|
654 | 654 | context 'updating existing route options' do |
655 | | - # using loadbalancing-algorithm as an example since it is the only route option currently supported |
| 655 | + # using loadbalancing as an example since it is the only route option currently supported |
656 | 656 | before do |
657 | 657 | yml_manifest = { |
658 | 658 | 'applications' => [ |
659 | 659 | { 'name' => app1_model.name, |
660 | 660 | 'routes' => [ |
661 | 661 | { 'route' => "https://round-robin-app.#{shared_domain.name}", |
662 | 662 | 'options' => { |
663 | | - 'loadbalancing-algorithm' => 'round-robin' |
| 663 | + 'loadbalancing' => 'round-robin' |
664 | 664 | } } |
665 | 665 | ] } |
666 | 666 | ] |
|
675 | 675 | Delayed::Worker.new.work_off |
676 | 676 | expect(VCAP::CloudController::PollableJobModel.find(guid: job_guid)).to be_complete, VCAP::CloudController::PollableJobModel.find(guid: job_guid).cf_api_error |
677 | 677 | app1_model.reload |
678 | | - expect(app1_model.routes.first.options).to eq({ 'lb_algo' => 'round-robin' }) |
| 678 | + expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
679 | 679 | end |
680 | 680 |
|
681 | 681 | it 'updates the route option when a new value is provided' do |
|
685 | 685 | 'routes' => [ |
686 | 686 | { 'route' => "https://round-robin-app.#{shared_domain.name}", |
687 | 687 | 'options' => { |
688 | | - 'loadbalancing-algorithm' => 'least-connections' |
| 688 | + 'loadbalancing' => 'least-connections' |
689 | 689 | } } |
690 | 690 | ] } |
691 | 691 | ] |
|
699 | 699 | Delayed::Worker.new.work_off |
700 | 700 | expect(VCAP::CloudController::PollableJobModel.find(guid: job_guid)).to be_complete, VCAP::CloudController::PollableJobModel.find(guid: job_guid).cf_api_error |
701 | 701 | app1_model.reload |
702 | | - expect(app1_model.routes.first.options).to eq({ 'lb_algo' => 'least-connections' }) |
| 702 | + expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'least-connections' }) |
703 | 703 | end |
704 | 704 |
|
705 | 705 | it 'does not modify any route options when the options hash is not provided' do |
|
721 | 721 | Delayed::Worker.new.work_off |
722 | 722 | expect(VCAP::CloudController::PollableJobModel.find(guid: job_guid)).to be_complete, VCAP::CloudController::PollableJobModel.find(guid: job_guid).cf_api_error |
723 | 723 | app1_model.reload |
724 | | - expect(app1_model.routes.first.options).to eq({ 'lb_algo' => 'round-robin' }) |
| 724 | + expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
725 | 725 | end |
726 | 726 |
|
727 | 727 | it 'does not modify any route options options: nil is provided' do |
|
744 | 744 | Delayed::Worker.new.work_off |
745 | 745 | expect(VCAP::CloudController::PollableJobModel.find(guid: job_guid)).to be_complete, VCAP::CloudController::PollableJobModel.find(guid: job_guid).cf_api_error |
746 | 746 | app1_model.reload |
747 | | - expect(app1_model.routes.first.options).to eq({ 'lb_algo' => 'round-robin' }) |
| 747 | + expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
748 | 748 | end |
749 | 749 |
|
750 | 750 | it 'does not modify any route options if an empty options hash is provided' do |
|
764 | 764 | expect(last_response.status).to eq(202) |
765 | 765 |
|
766 | 766 | app1_model.reload |
767 | | - expect(app1_model.routes.first.options).to eq({ 'lb_algo' => 'round-robin' }) |
| 767 | + expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
768 | 768 | end |
769 | 769 |
|
770 | 770 | it 'does not modify any option when options: { key: nil } is provided' do |
|
774 | 774 | 'routes' => [ |
775 | 775 | { 'route' => "https://round-robin-app.#{shared_domain.name}", |
776 | 776 | 'options' => { |
777 | | - 'loadbalancing-algorithm' => nil |
| 777 | + 'loadbalancing' => nil |
778 | 778 | } } |
779 | 779 | ] } |
780 | 780 | ] |
|
786 | 786 | expect(last_response.status).to eq(202) |
787 | 787 |
|
788 | 788 | app1_model.reload |
789 | | - expect(app1_model.routes.first.options).to eq({ 'lb_algo' => 'round-robin' }) |
| 789 | + expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
790 | 790 | end |
791 | 791 | end |
792 | 792 |
|
793 | | - context 'route-option: loadbalancing-algorithm' do |
794 | | - context 'when the loadbalancing-algorithm is not supported' do |
| 793 | + context 'route-option: loadbalancing' do |
| 794 | + context 'when the loadbalancing is not supported' do |
795 | 795 | let(:yml_manifest) do |
796 | 796 | { |
797 | 797 | 'applications' => [ |
|
800 | 800 | 'routes' => [ |
801 | 801 | { 'route' => "https://#{route.host}.#{route.domain.name}", |
802 | 802 | 'options' => { |
803 | | - 'loadbalancing-algorithm' => 'unsupported-lb-algorithm' |
| 803 | + 'loadbalancing' => 'unsupported-lb-algorithm' |
804 | 804 | } } |
805 | 805 | ] |
806 | 806 | } |
|
817 | 817 | end |
818 | 818 | end |
819 | 819 |
|
820 | | - context 'when the loadbalancing-algorithm is supported' do |
| 820 | + context 'when the loadbalancing is supported' do |
821 | 821 | let(:yml_manifest) do |
822 | 822 | { |
823 | 823 | 'applications' => [ |
824 | 824 | { 'name' => app1_model.name, |
825 | 825 | 'routes' => [ |
826 | 826 | { 'route' => "https://round-robin-app.#{shared_domain.name}", |
827 | 827 | 'options' => { |
828 | | - 'loadbalancing-algorithm' => 'round-robin' |
| 828 | + 'loadbalancing' => 'round-robin' |
829 | 829 | } } |
830 | 830 | ] } |
831 | 831 | ] |
832 | 832 | }.to_yaml |
833 | 833 | end |
834 | 834 |
|
835 | | - it 'adds the loadbalancing-algorithm' do |
| 835 | + it 'adds the loadbalancing' do |
836 | 836 | post "/v3/spaces/#{space.guid}/actions/apply_manifest", yml_manifest, yml_headers(user_header) |
837 | 837 |
|
838 | 838 | expect(last_response.status).to eq(202) |
|
842 | 842 | expect(VCAP::CloudController::PollableJobModel.find(guid: job_guid)).to be_complete, VCAP::CloudController::PollableJobModel.find(guid: job_guid).cf_api_error |
843 | 843 |
|
844 | 844 | app1_model.reload |
845 | | - expect(app1_model.routes.first.options).to eq({ 'lb_algo' => 'round-robin' }) |
| 845 | + expect(app1_model.routes.first.options).to eq({ 'loadbalancing' => 'round-robin' }) |
846 | 846 | end |
847 | 847 | end |
848 | 848 | end |
|
0 commit comments