@@ -61,6 +61,7 @@ domain=$testprefix-domain-$timestamp.com
61
61
62
62
app_name=$testprefix -app-$timestamp
63
63
broker_name=$testprefix -broker
64
+ broker_space_scoped_name=$testprefix -space-scoped-broker
64
65
65
66
users_csv=$( cat << EOF
66
67
Username,Password,Org,Space,OrgManager,BillingManager,OrgAuditor,SpaceManager,SpaceDeveloper,SpaceAuditor
@@ -87,8 +88,6 @@ source=$(jq -n \
87
88
skip_cert_check: "true",
88
89
username: $username,
89
90
password: $password,
90
- org: $org,
91
- space: $space,
92
91
debug: false,
93
92
cf_color: $cf_color,
94
93
cf_dial_timeout: $cf_dial_timeout,
@@ -471,6 +470,8 @@ it_can_zero_downtime_push() {
471
470
--arg app_name " $app_name " \
472
471
' {
473
472
command: "zero-downtime-push",
473
+ org: $org,
474
+ space: $space,
474
475
manifest: "static-app/manifest.yml",
475
476
current_app_name: $app_name,
476
477
environment_variables: {
@@ -610,6 +611,8 @@ it_can_scale_an_app_instances() {
610
611
--arg instances " 2" \
611
612
' {
612
613
command: "scale",
614
+ org: $org,
615
+ space: $space,
613
616
app_name: $app_name,
614
617
instances: $instances
615
618
}' )
@@ -633,6 +636,8 @@ it_can_scale_an_app_disk_quota() {
633
636
--arg disk_quota " 512M" \
634
637
' {
635
638
command: "scale",
639
+ org: $org,
640
+ space: $space,
636
641
app_name: $app_name,
637
642
disk_quota: $disk_quota
638
643
}' )
@@ -656,6 +661,8 @@ it_can_scale_an_app_memory() {
656
661
--arg memory " 512M" \
657
662
' {
658
663
command: "scale",
664
+ org: $org,
665
+ space: $space,
659
666
app_name: $app_name,
660
667
memory: $memory
661
668
}' )
@@ -681,6 +688,8 @@ it_can_scale_an_app() {
681
688
--arg memory " 1G" \
682
689
' {
683
690
command: "scale",
691
+ org: $org,
692
+ space: $space,
684
693
app_name: $app_name,
685
694
instances: $instances,
686
695
disk_quota: $disk_quota,
@@ -703,10 +712,10 @@ it_can_create_a_domain() {
703
712
704
713
local params=$( jq -n \
705
714
--arg org " $org " \
706
- --arg space " $space " \
707
715
--arg domain " $domain " \
708
716
' {
709
717
command: "create-domain",
718
+ org: $org,
710
719
domain: $domain
711
720
}' )
712
721
@@ -724,10 +733,10 @@ it_can_delete_a_domain() {
724
733
725
734
local params=$( jq -n \
726
735
--arg org " $org " \
727
- --arg space " $space " \
728
736
--arg domain " $domain " \
729
737
' {
730
738
command: "delete-domain",
739
+ org: $org,
731
740
domain: $domain
732
741
}' )
733
742
@@ -750,6 +759,8 @@ it_can_map_a_route() {
750
759
--arg domain " $domain " \
751
760
' {
752
761
command: "map-route",
762
+ org: $org,
763
+ space: $space,
753
764
app_name: $app_name,
754
765
domain: $domain
755
766
}' )
@@ -773,6 +784,8 @@ it_can_map_a_route_with_hostname() {
773
784
--arg hostname " $app_name " \
774
785
' {
775
786
command: "map-route",
787
+ org: $org,
788
+ space: $space,
776
789
app_name: $app_name,
777
790
domain: $domain,
778
791
hostname: $hostname
@@ -798,6 +811,8 @@ it_can_map_a_route_with_hostname_and_path() {
798
811
--arg path " foo" \
799
812
' {
800
813
command: "map-route",
814
+ org: $org,
815
+ space: $space,
801
816
app_name: $app_name,
802
817
domain: $domain,
803
818
hostname: $hostname,
@@ -824,6 +839,8 @@ it_can_unmap_a_route_with_hostname_and_path() {
824
839
--arg path " foo" \
825
840
' {
826
841
command: "unmap-route",
842
+ org: $org,
843
+ space: $space,
827
844
app_name: $app_name,
828
845
domain: $domain,
829
846
hostname: $hostname,
@@ -849,6 +866,8 @@ it_can_unmap_a_route_with_hostname() {
849
866
--arg hostname " $app_name " \
850
867
' {
851
868
command: "unmap-route",
869
+ org: $org,
870
+ space: $space,
852
871
app_name: $app_name,
853
872
domain: $domain,
854
873
hostname: $hostname
@@ -872,6 +891,8 @@ it_can_unmap_a_route() {
872
891
--arg domain " $domain " \
873
892
' {
874
893
command: "unmap-route",
894
+ org: $org,
895
+ space: $space,
875
896
app_name: $app_name,
876
897
domain: $domain
877
898
}' )
@@ -884,6 +905,61 @@ it_can_unmap_a_route() {
884
905
# TODO: check that the route was unmapped
885
906
}
886
907
908
+ it_can_create_a_service_broker_space_scoped () {
909
+ local working_dir=$( mktemp -d $TMPDIR /put-src.XXXXXX)
910
+
911
+ local commit=dddec578676b8dcbe06158e3ac0b34edc6f5de6e
912
+
913
+ # if tests are running in concourse, the overview-broker.zip is provided
914
+ # by the pipeline. Otherwise, if we are running locally, we'll need to
915
+ # download it.
916
+ local broker_dir=$working_dir /broker
917
+ if [ -d " /opt/service-broker" ]; then
918
+ broker_dir=/opt/service-broker
919
+ else
920
+ mkdir -p $broker_dir
921
+ fi
922
+
923
+ if [ ! -f " $broker_dir /overview-broker.zip" ]; then
924
+ wget https://github.com/mattmcneeney/overview-broker/archive/$commit .zip -O $broker_dir /overview-broker.zip
925
+ fi
926
+
927
+ if [ ! -d " $broker_dir /overview-broker-$commit " ]; then
928
+ unzip $broker_dir /overview-broker.zip -d $broker_dir
929
+ fi
930
+
931
+ cf_login " $cf_api " " $cf_username " " $cf_password " " $cf_skip_cert_check "
932
+ cf_target " $org " " $space "
933
+ cf push " ${broker_space_scoped_name} " -p " $broker_dir /overview-broker-$commit " # -b "https://github.com/cloudfoundry/nodejs-buildpack#v1.6.11"
934
+ cf logout
935
+
936
+ local params=$( jq -n \
937
+ --arg org " $org " \
938
+ --arg space " $space " \
939
+ --arg service_broker " ${broker_space_scoped_name} " \
940
+ --arg username admin \
941
+ --arg password password \
942
+ --arg url " https://${broker_space_scoped_name} .$cf_apps_domain " \
943
+ ' {
944
+ command: "create-service-broker",
945
+ org: $org,
946
+ space: $space,
947
+ service_broker: $service_broker,
948
+ username: $username,
949
+ password: $password,
950
+ url: $url,
951
+ space_scoped: true
952
+ }' )
953
+
954
+ local config=$( echo $source | jq --argjson params " $params " ' .params = $params' )
955
+
956
+ put_with_params " $config " " $working_dir " | jq -e '
957
+ .version | keys == ["timestamp"]
958
+ '
959
+
960
+ cf_service_broker_exists " ${broker_space_scoped_name} "
961
+ }
962
+
887
963
it_can_create_a_service_broker () {
888
964
local working_dir=$( mktemp -d $TMPDIR /put-src.XXXXXX)
889
965
@@ -907,8 +983,10 @@ it_can_create_a_service_broker() {
907
983
unzip $broker_dir /overview-broker.zip -d $broker_dir
908
984
fi
909
985
986
+ cf_login " $cf_api " " $cf_username " " $cf_password " " $cf_skip_cert_check "
910
987
cf_target " $org " " $space "
911
- cf push " $broker_name " -p " $broker_dir /overview-broker-$commit " -b " https://github.com/cloudfoundry/nodejs-buildpack#v1.6.11"
988
+ cf push " $broker_name " -p " $broker_dir /overview-broker-$commit "
989
+ cf logout
912
990
913
991
local params=$( jq -n \
914
992
--arg org " $org " \
@@ -919,8 +997,6 @@ it_can_create_a_service_broker() {
919
997
--arg url " https://$broker_name .$cf_apps_domain " \
920
998
' {
921
999
command: "create-service-broker",
922
- org: $org,
923
- space: $space,
924
1000
service_broker: $service_broker,
925
1001
username: $username,
926
1002
password: $password,
@@ -1403,6 +1479,7 @@ run it_can_create_a_user_with_password
1403
1479
run it_can_create_a_user_with_origin
1404
1480
run it_can_create_users_from_file
1405
1481
1482
+ run it_can_create_a_service_broker_space_scoped
1406
1483
run it_can_create_a_service_broker
1407
1484
# run again to prove that it won't error out if it already exists
1408
1485
run it_can_create_a_service_broker
0 commit comments