diff --git a/circle.yml b/circle.yml index c3067d7..c82b670 100644 --- a/circle.yml +++ b/circle.yml @@ -34,11 +34,12 @@ dependencies: - $ROOTPATH/ernest/internal/ci_install_service.sh r3labs composable master - $ROOTPATH/ernest/internal/ci_install_service.sh ernestio ernest-cli $CLI_VERSION - mkdir /tmp/composable + - composable set build.path /tmp/composable - sed -i "s:443 ssl:80:g" $ROOTPATH/ernest/config/nginx/ernest.local - sed -i "s:ERNESTHOST:ernest.local:g" $ROOTPATH/ernest/config/nginx/ernest.local - sed -i "/ssl_certificate/d" $ROOTPATH/ernest/config/nginx/ernest.local - sed -i "s:443:80:g" $ROOTPATH/ernest/template.yml - - cd $ROOTPATH/ernest && composable gen -E ERNEST_CRYPTO_KEY=$ERNEST_CRYPTO_KEY -exclude='*-aws-connector,*-vcloud-connector' -G $BASE_VERSION $EXTRA_OPTIONS definition.yml template.yml -- + - cd $ROOTPATH/ernest && composable generate -E ERNEST_CRYPTO_KEY=$ERNEST_CRYPTO_KEY -exclude='*-aws-connector,*-vcloud-connector' -G $BASE_VERSION $EXTRA_OPTIONS definition.yml template.yml -- - cd $ROOTPATH/ernest && docker-compose -f docker-compose.yml up -d - cd $ROOTPATH/ernest && docker-compose logs > /tmp/compose.log: background: true @@ -50,4 +51,3 @@ dependencies: test: override: - cd $ROOTPATH/ernest && make test - diff --git a/config/config-store/config.json b/config/config-store/config.json index 90a7944..5572afc 100644 --- a/config/config-store/config.json +++ b/config/config-store/config.json @@ -1,8 +1,8 @@ { - "redis": { - "addr": "redis:6379", - "password": "", - "DB": 0 + "authenticator": { + "providers": [ + {"type": "local"} + ] }, "postgres": { "names": [ @@ -27,57 +27,5 @@ "logger": { "host": "", "port": "22001" - }, - "connectors": { - "routers": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake", - "azure", - "azure-fake" - ], - "networks": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "instances": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "firewalls": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "nats": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "elbs": [ - "fake", - "aws", - "aws-fake" - ], - "executions": [ - "fake", - "salt" - ] - }, - "salt": { - "user": "salt", - "password": "33Arma33" } } diff --git a/definition.yml b/definition.yml index 26f4fad..c625bd5 100644 --- a/definition.yml +++ b/definition.yml @@ -19,7 +19,19 @@ repos: - nats ports: - 8080:8080 - depends: + depends_on: + - config-store + environment: + NATS_URI: 'nats://nats:4222' + JWT_SECRET: 'GENERATEDJWTSECRET' + ERNEST_CRYPTO_KEY: CRYPTO_KEY_TEMPLATE + + - name: authenticator + path: git@github.com:ernestio/authenticator.git + branch: master + links: + - nats + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -33,7 +45,7 @@ repos: - nats ports: - 22000:22000 - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -45,52 +57,51 @@ repos: branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' ERNEST_CRYPTO_KEY: CRYPTO_KEY_TEMPLATE - - name: group-store - path: git@github.com:ernestio/group-store.git + - name: datacenter-store + path: git@github.com:ernestio/datacenter-store.git branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' ERNEST_CRYPTO_KEY: CRYPTO_KEY_TEMPLATE - - name: datacenter-store - path: git@github.com:ernestio/datacenter-store.git + - name: service-store + path: git@github.com:ernestio/service-store.git branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' ERNEST_CRYPTO_KEY: CRYPTO_KEY_TEMPLATE - - name: service-store - path: git@github.com:ernestio/service-store.git + - name: authorization-store + path: git@github.com:ernestio/authorization-store.git branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' ERNEST_CRYPTO_KEY: CRYPTO_KEY_TEMPLATE - - name: usage-store path: git@github.com:ernestio/usage-store.git branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -102,7 +113,7 @@ repos: links: - nats - postgres - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -114,7 +125,7 @@ repos: links: - nats - postgres - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -125,7 +136,7 @@ repos: branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -137,7 +148,7 @@ repos: branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -148,7 +159,7 @@ repos: branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -159,7 +170,7 @@ repos: branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' @@ -173,7 +184,7 @@ repos: - nats ports: - 22001:22001 - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' diff --git a/docker-compose.yml b/docker-compose.yml index bbbffe6..7cf2615 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -50,6 +50,16 @@ services: ERNEST_CRYPTO_KEY: CRYPTO_KEY_TEMPLATE JWT_SECRET: GENERATEDJWTSECRET NATS_URI: nats://nats:4222 + authenticator: + image: ernestio/authenticator:2.1.0 + links: + - nats + depends_on: + - config-store + environment: + ERNEST_CRYPTO_KEY: CRYPTO_KEY_TEMPLATE + JWT_SECRET: GENERATEDJWTSECRET + NATS_URI: nats://nats:4222 config-store: image: ernestio/config-store:2.2.0 entrypoint: /go/bin/config-store -config /etc/ernest/config.json diff --git a/internal/ci_setup.sh b/internal/ci_setup.sh index 8f0620d..579155d 100755 --- a/internal/ci_setup.sh +++ b/internal/ci_setup.sh @@ -1,11 +1,8 @@ -$GOBIN/natsc request -s $NATS_URI -t 5 -r 99 'group.set' '{"id":"1","name": "ci_admin"}' -$GOBIN/natsc request -s $NATS_URI -t 5 -r 99 'user.set' '{"group_id": 1, "username": "ci_admin", "password": "secret123", "admin":true}' +$GOBIN/natsc request -s $NATS_URI -t 5 -r 99 'user.set' '{"username": "ci_admin", "password": "secret123", "type": "local", "admin":true}' ernest-cli target $CURRENT_INSTANCE ernest-cli login --user ci_admin --password secret123 ernest-cli user create usr secret123 -ernest-cli group create test -ernest-cli group add-user usr test ernest-cli login --user usr --password secret123 -ernest-cli datacenter create aws fakeaws --region fake --secret_access_key fake_up_to_16_characters --access_key_id up_to_16_characters_secret --fake -ernest-cli datacenter create vcloud fakevcloud -org test -user fakeuser -password test123 -public-network test-nw -vcloud-url https://vcloud.net --fake -ernest-cli datacenter create azure --subscription_id subid --client_id cliid --client_secret clisec --region westus --tenant_id tenid --environment public --fake fakeazure +ernest-cli project create aws fakeaws --region fake --secret_access_key fake_up_to_16_characters --access_key_id up_to_16_characters_secret --fake +ernest-cli project create vcloud fakevcloud -org test -user fakeuser -password test123 -public-network test-nw -vcloud-url https://vcloud.net --fake +ernest-cli project create azure --subscription_id subid --client_id cliid --client_secret clisec --region westus --tenant_id tenid --environment public --fake fakeazure diff --git a/internal/config.tmp.json b/internal/config.tmp.json index bd8b385..d73aa27 100644 --- a/internal/config.tmp.json +++ b/internal/config.tmp.json @@ -1,9 +1,4 @@ { - "redis": { - "addr": "redis:6379", - "password": "", - "DB": 0 - }, "postgres": { "names": [ "users", @@ -23,50 +18,5 @@ "monitor": { "host": "127.0.0.1", "port": "22000" - }, - "connectors": { - "routers": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "networks": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "instances": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "firewalls": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "nats": [ - "fake", - "vcloud", - "vcloud-fake", - "aws", - "aws-fake" - ], - "executions": [ - "fake", - "salt" - ] - }, - "salt": { - "user": "salt", - "password": "---" } } diff --git a/internal/definitions/aws-template1-completed.yml b/internal/definitions/aws-template1-completed.yml index 09bd9bb..e3d0ef2 100644 --- a/internal/definitions/aws-template1-completed.yml +++ b/internal/definitions/aws-template1-completed.yml @@ -1,5 +1,5 @@ name: aws-test-4 -datacenter: tom-aws +project: tom-aws bootstrapping: none vpc_id: vpc-a921accd networks: diff --git a/internal/definitions/aws-template1-unexisting.yml b/internal/definitions/aws-template1-unexisting.yml index e633b46..96936d7 100644 --- a/internal/definitions/aws-template1-unexisting.yml +++ b/internal/definitions/aws-template1-unexisting.yml @@ -1,5 +1,5 @@ name: aws-test-999 -datacenter: fakeaws +project: fakeaws bootstrapping: none vpc_id: vpc-a921accd networks: diff --git a/internal/definitions/aws-template1.yml b/internal/definitions/aws-template1.yml index ecaa0d6..7531345 100644 --- a/internal/definitions/aws-template1.yml +++ b/internal/definitions/aws-template1.yml @@ -1,5 +1,5 @@ name: aws-test-4 -datacenter: tom-aws +project: tom-aws bootstrapping: none vpc_id: vpc-a921accd networks: diff --git a/internal/definitions/aws1.yml b/internal/definitions/aws1.yml index f0beaaf..8e07f74 100644 --- a/internal/definitions/aws1.yml +++ b/internal/definitions/aws1.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws10.yml b/internal/definitions/aws10.yml index 950d6a0..4ad664a 100644 --- a/internal/definitions/aws10.yml +++ b/internal/definitions/aws10.yml @@ -1,7 +1,7 @@ # Add a network and attach a new instance --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws11.yml b/internal/definitions/aws11.yml index 84ed8bd..2cbf32a 100644 --- a/internal/definitions/aws11.yml +++ b/internal/definitions/aws11.yml @@ -1,7 +1,7 @@ # Remove a network and remove the new instance --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws12.yml b/internal/definitions/aws12.yml index 12017de..e6e20be 100644 --- a/internal/definitions/aws12.yml +++ b/internal/definitions/aws12.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws13.yml b/internal/definitions/aws13.yml index c7c44f9..cdef426 100644 --- a/internal/definitions/aws13.yml +++ b/internal/definitions/aws13.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws14.yml b/internal/definitions/aws14.yml index 5c8c436..e3707e0 100644 --- a/internal/definitions/aws14.yml +++ b/internal/definitions/aws14.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws15.yml b/internal/definitions/aws15.yml index 12017de..e6e20be 100644 --- a/internal/definitions/aws15.yml +++ b/internal/definitions/aws15.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws16.yml b/internal/definitions/aws16.yml index 332f0f7..178aa3e 100644 --- a/internal/definitions/aws16.yml +++ b/internal/definitions/aws16.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws17.yml b/internal/definitions/aws17.yml index 0075031..e9d5077 100644 --- a/internal/definitions/aws17.yml +++ b/internal/definitions/aws17.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws18.yml b/internal/definitions/aws18.yml index 898d0d0..7f924e1 100644 --- a/internal/definitions/aws18.yml +++ b/internal/definitions/aws18.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws19.yml b/internal/definitions/aws19.yml index cf6cea9..2cea104 100644 --- a/internal/definitions/aws19.yml +++ b/internal/definitions/aws19.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws2.yml b/internal/definitions/aws2.yml index 9220ec7..60b6cb2 100644 --- a/internal/definitions/aws2.yml +++ b/internal/definitions/aws2.yml @@ -1,7 +1,7 @@ # Increasing the instance count against aws1.yml --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws20.yml b/internal/definitions/aws20.yml index 0075031..e9d5077 100644 --- a/internal/definitions/aws20.yml +++ b/internal/definitions/aws20.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws21.yml b/internal/definitions/aws21.yml index ef474a4..d318488 100644 --- a/internal/definitions/aws21.yml +++ b/internal/definitions/aws21.yml @@ -1,7 +1,7 @@ # Add a nat gateway and attach a private network to it --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws3.yml b/internal/definitions/aws3.yml index f0beaaf..8e07f74 100644 --- a/internal/definitions/aws3.yml +++ b/internal/definitions/aws3.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws4.yml b/internal/definitions/aws4.yml index 3b9a893..d7f4554 100644 --- a/internal/definitions/aws4.yml +++ b/internal/definitions/aws4.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws5.yml b/internal/definitions/aws5.yml index 86604a0..a71ff0a 100644 --- a/internal/definitions/aws5.yml +++ b/internal/definitions/aws5.yml @@ -1,7 +1,7 @@ # Add ingress security group --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws6.yml b/internal/definitions/aws6.yml index dbf4e87..697512c 100644 --- a/internal/definitions/aws6.yml +++ b/internal/definitions/aws6.yml @@ -1,7 +1,7 @@ # Add engress security group --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws7.yml b/internal/definitions/aws7.yml index f27e7b1..a55df17 100644 --- a/internal/definitions/aws7.yml +++ b/internal/definitions/aws7.yml @@ -1,7 +1,7 @@ # Remove engress and ingress security groups --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws8.yml b/internal/definitions/aws8.yml index dcf25c0..dacbd60 100644 --- a/internal/definitions/aws8.yml +++ b/internal/definitions/aws8.yml @@ -1,7 +1,7 @@ # Add a network --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/aws9.yml b/internal/definitions/aws9.yml index d9b85dd..baaae8d 100644 --- a/internal/definitions/aws9.yml +++ b/internal/definitions/aws9.yml @@ -1,7 +1,7 @@ # Remove a network --- name: my_service -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: test-vpc diff --git a/internal/definitions/azure1.yml b/internal/definitions/azure1.yml index 642b009..7bc8480 100644 --- a/internal/definitions/azure1.yml +++ b/internal/definitions/azure1.yml @@ -1,5 +1,5 @@ name: my_service -datacenter: fakeazure +project: fakeazure resource_groups: - name: rg2 diff --git a/internal/definitions/azure2.yml b/internal/definitions/azure2.yml index c092699..813e4a9 100644 --- a/internal/definitions/azure2.yml +++ b/internal/definitions/azure2.yml @@ -1,5 +1,5 @@ name: my_service -datacenter: fakeazure +project: fakeazure resource_groups: - name: az-test diff --git a/internal/definitions/azure3.yml b/internal/definitions/azure3.yml index a319b2a..f97bb28 100644 --- a/internal/definitions/azure3.yml +++ b/internal/definitions/azure3.yml @@ -1,5 +1,5 @@ name: my_service -datacenter: fakeazure +project: fakeazure resource_groups: - name: az-test diff --git a/internal/definitions/azure4.yml b/internal/definitions/azure4.yml index 73fbbfa..695b71b 100644 --- a/internal/definitions/azure4.yml +++ b/internal/definitions/azure4.yml @@ -1,5 +1,5 @@ name: my_service -datacenter: fakeazure +project: fakeazure resource_groups: - name: az-test diff --git a/internal/definitions/azure5.yml b/internal/definitions/azure5.yml index 03c659b..942e5d8 100644 --- a/internal/definitions/azure5.yml +++ b/internal/definitions/azure5.yml @@ -1,5 +1,5 @@ name: my_service -datacenter: fakeazure +project: fakeazure resource_groups: - name: az-test diff --git a/internal/definitions/azure6.yml b/internal/definitions/azure6.yml index b0f62a9..38524f6 100644 --- a/internal/definitions/azure6.yml +++ b/internal/definitions/azure6.yml @@ -1,5 +1,5 @@ name: my_service -datacenter: fakeazure +project: fakeazure resource_groups: - name: az-test diff --git a/internal/definitions/destroyable.yml b/internal/definitions/destroyable.yml index 552a237..5ba4561 100644 --- a/internal/definitions/destroyable.yml +++ b/internal/definitions/destroyable.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: destroyable -datacenter: r3-dc2 +project: r3-dc2 bootstrapping: none service_ip: 172.16.186.44 vpcs: diff --git a/internal/definitions/destroyable2.yml b/internal/definitions/destroyable2.yml index f99abb6..4086b34 100644 --- a/internal/definitions/destroyable2.yml +++ b/internal/definitions/destroyable2.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: destroyable -datacenter: r3-dc2 +project: r3-dc2 bootstrapping: none service_ip: 172.16.186.44 vpcs: diff --git a/internal/definitions/referenced.yml b/internal/definitions/referenced.yml index 2d033a7..f93ce91 100644 --- a/internal/definitions/referenced.yml +++ b/internal/definitions/referenced.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: my_service -datacenter: test_dc +project: test_dc bootstrapping: none service_ip: 172.16.186.44 vpcs: diff --git a/internal/definitions/service-revert.yml b/internal/definitions/service-revert.yml index 0e8a900..23e5e89 100644 --- a/internal/definitions/service-revert.yml +++ b/internal/definitions/service-revert.yml @@ -1,6 +1,6 @@ --- name: myService -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: myVPC diff --git a/internal/definitions/service-revert2.yml b/internal/definitions/service-revert2.yml index f02f468..488dcf3 100644 --- a/internal/definitions/service-revert2.yml +++ b/internal/definitions/service-revert2.yml @@ -1,6 +1,6 @@ --- name: myService2 -datacenter: r3-dc2 +project: r3-dc2 vpcs: - name: myVPC diff --git a/internal/definitions/unexisting_dc.yml b/internal/definitions/unexisting_dc.yml index 4700d0f..072d101 100644 --- a/internal/definitions/unexisting_dc.yml +++ b/internal/definitions/unexisting_dc.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: aws_test_service -datacenter: non_existing_dc +project: non_existing_dc bootstrapping: none service_ip: 172.16.186.44 vpcs: diff --git a/internal/definitions/update_datacenter_aws_1.yml b/internal/definitions/update_project_aws_1.yml similarity index 95% rename from internal/definitions/update_datacenter_aws_1.yml rename to internal/definitions/update_project_aws_1.yml index 5764e1e..7eb10de 100644 --- a/internal/definitions/update_datacenter_aws_1.yml +++ b/internal/definitions/update_project_aws_1.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: aws_test_update_dc -datacenter: update_datacenter +project: update_project vpcs: - name: test-vpc diff --git a/internal/definitions/update_datacenter_aws_2.yml b/internal/definitions/update_project_aws_2.yml similarity index 95% rename from internal/definitions/update_datacenter_aws_2.yml rename to internal/definitions/update_project_aws_2.yml index dbb3912..4ec3189 100644 --- a/internal/definitions/update_datacenter_aws_2.yml +++ b/internal/definitions/update_project_aws_2.yml @@ -1,7 +1,7 @@ # Basic aws example --- name: aws_test_update_dc -datacenter: update_datacenter +project: update_project vpcs: - name: test-vpc diff --git a/internal/definitions/vcloud1.yml b/internal/definitions/vcloud1.yml index a9639eb..1eda66c 100644 --- a/internal/definitions/vcloud1.yml +++ b/internal/definitions/vcloud1.yml @@ -1,10 +1,10 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud routers: - name: vse2 - rules: + firewall_rules: - name: in_in_any source: internal from_port: any @@ -41,11 +41,13 @@ routers: - name: web subnet: 10.1.0.0/24 - port_forwarding: + nat_rules: - source: 172.16.186.44 from_port: '22' to_port: '22' destination: 10.1.0.11 + protocol: tcp + type: dnat instances: - name: web diff --git a/internal/definitions/vcloud2.yml b/internal/definitions/vcloud2.yml index 28b5af9..80b3da4 100644 --- a/internal/definitions/vcloud2.yml +++ b/internal/definitions/vcloud2.yml @@ -1,10 +1,10 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud routers: - name: vse2 - rules: + firewall_rules: - name: in_in_any source: internal from_port: any @@ -37,8 +37,10 @@ routers: protocol: tcp action: allow - port_forwarding: + nat_rules: - source: 172.16.186.44 from_port: '22' to_port: '22' destination: 10.1.0.11 + protocol: tcp + type: dnat diff --git a/internal/definitions/vcloud3.yml b/internal/definitions/vcloud3.yml index a9639eb..2cd7447 100644 --- a/internal/definitions/vcloud3.yml +++ b/internal/definitions/vcloud3.yml @@ -1,10 +1,10 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud routers: - name: vse2 - rules: + firewall_rules: - name: in_in_any source: internal from_port: any @@ -41,12 +41,14 @@ routers: - name: web subnet: 10.1.0.0/24 - port_forwarding: + nat_rules: - source: 172.16.186.44 from_port: '22' to_port: '22' destination: 10.1.0.11 - + protocol: tcp + type: dnat + instances: - name: web image: r3/ubuntu-1404 diff --git a/internal/definitions/vcloud4.yml b/internal/definitions/vcloud4.yml index 1c6ff79..a747f83 100644 --- a/internal/definitions/vcloud4.yml +++ b/internal/definitions/vcloud4.yml @@ -1,10 +1,10 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud routers: - name: vse2 - rules: + firewall_rules: - name: in_in_any source: internal from_port: any @@ -41,11 +41,13 @@ routers: - name: web subnet: 10.1.0.0/24 - port_forwarding: + nat_rules: - source: 172.16.186.44 from_port: '22' to_port: '22' destination: 10.1.0.11 + protocol: tcp + type: dnat instances: - name: web diff --git a/internal/definitions/vcloud5.yml b/internal/definitions/vcloud5.yml index 04ae360..27eed1c 100644 --- a/internal/definitions/vcloud5.yml +++ b/internal/definitions/vcloud5.yml @@ -1,10 +1,10 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud routers: - name: vse2 - rules: + firewall_rules: - name: in_in_any source: internal from_port: any @@ -41,11 +41,13 @@ routers: - name: web subnet: 10.1.0.0/24 - port_forwarding: + nat_rules: - source: 172.16.186.44 from_port: '22' to_port: '22' destination: 10.1.0.11 + protocol: tcp + type: dnat instances: - name: web diff --git a/internal/definitions/vcloud6.yml b/internal/definitions/vcloud6.yml index 280a107..5121834 100644 --- a/internal/definitions/vcloud6.yml +++ b/internal/definitions/vcloud6.yml @@ -1,10 +1,10 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud routers: - name: vse2 - rules: + firewall_rules: - name: in_in_any source: internal from_port: any @@ -41,16 +41,20 @@ routers: - name: web subnet: 10.1.0.0/24 - port_forwarding: + nat_rules: - source: 172.16.186.44 from_port: '22' to_port: '22' destination: 10.1.0.11 + protocol: tcp + type: dnat - source: 11.11.11.11 from_port: '22' to_port: '22' destination: 10.1.0.11 - + protocol: tcp + type: dnat + instances: - name: web image: r3/ubuntu-1404 diff --git a/internal/definitions/vcloud7.yml b/internal/definitions/vcloud7.yml index 875e70f..266f519 100644 --- a/internal/definitions/vcloud7.yml +++ b/internal/definitions/vcloud7.yml @@ -1,10 +1,10 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud routers: - name: vse2 - rules: + firewall_rules: - name: in_in_any source: internal from_port: any @@ -41,11 +41,13 @@ routers: - name: web subnet: 10.1.0.0/24 - port_forwarding: + nat_rules: - source: 172.16.186.44 from_port: '22' to_port: '22' destination: 10.1.0.11 + protocol: tcp + type: dnat instances: - name: web diff --git a/internal/definitions/vcloud8.yml b/internal/definitions/vcloud8.yml index ced03df..a19d036 100644 --- a/internal/definitions/vcloud8.yml +++ b/internal/definitions/vcloud8.yml @@ -1,6 +1,6 @@ --- name: my_service -datacenter: fakevcloud +project: fakevcloud instances: - name: web diff --git a/internal/features/aws/add_and_attach_network.feature b/internal/features/aws/add_and_attach_network.feature index 421a816..eed8053 100644 --- a/internal/features/aws/add_and_attach_network.feature +++ b/internal/features/aws/add_and_attach_network.feature @@ -1,9 +1,9 @@ @aws @add_and_attach_network -Feature: Service apply +Feature: Environment apply Scenario: Add a network and attach a new instance Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws9.yml" And I start recording @@ -11,10 +11,10 @@ Feature: Service apply And I stop recording Then an event "network.create.aws-fake" should be called exactly "1" times And all "network.create.aws-fake" messages should contain a field "_provider" with "aws-fake" - And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain a field "vpc_id" with "fakeaws" And all "network.create.aws-fake" messages should contain a field "name" with "bknd" And all "network.create.aws-fake" messages should contain a field "range" with "10.2.0.0/24" + And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "up_to_16_characters_secret" And all "network.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "fake_up_to_16_characters" Then an event "instance.create.aws-fake" should be called exactly "1" times diff --git a/internal/features/aws/add_egress_security_group.feature b/internal/features/aws/add_egress_security_group.feature index 69745cb..fdc824d 100644 --- a/internal/features/aws/add_egress_security_group.feature +++ b/internal/features/aws/add_egress_security_group.feature @@ -1,9 +1,9 @@ @aws @add_egress_security_group -Feature: Service apply +Feature: Environment apply Scenario: Add engress security group to a instance Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws5.yml" And I start recording diff --git a/internal/features/aws/add_elb_and_s3.feature b/internal/features/aws/add_elb_and_s3.feature index 6f0d643..8a5478d 100644 --- a/internal/features/aws/add_elb_and_s3.feature +++ b/internal/features/aws/add_elb_and_s3.feature @@ -1,9 +1,9 @@ @aws @add_elb_and_s3 -Feature: Service apply +Feature: Environment apply Scenario: Add an elb and an s3 Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws12.yml" And I start recording diff --git a/internal/features/aws/add_ingress_security_group.feature b/internal/features/aws/add_ingress_security_group.feature index 6f77393..0c51332 100644 --- a/internal/features/aws/add_ingress_security_group.feature +++ b/internal/features/aws/add_ingress_security_group.feature @@ -1,9 +1,9 @@ @aws @add_ingress_security_group -Feature: Service apply +Feature: Environment apply Scenario: Add an ingress security group to an instance Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws4.yml" And I start recording diff --git a/internal/features/aws/add_nat_and_attach_a_network.feature b/internal/features/aws/add_nat_and_attach_a_network.feature index aba287b..12020bf 100644 --- a/internal/features/aws/add_nat_and_attach_a_network.feature +++ b/internal/features/aws/add_nat_and_attach_a_network.feature @@ -1,9 +1,9 @@ @aws @add_nat_and_attach_a_network -Feature: Service apply +Feature: Environment apply Scenario: Add a nat gateway and attach a private network to it Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws11.yml" And I start recording @@ -20,8 +20,8 @@ Feature: Service apply And all "nat.create.aws-fake" messages should contain a field "_state" with "running" Then an event "network.create.aws-fake" should be called exactly "1" times And all "network.create.aws-fake" messages should contain a field "_provider" with "aws-fake" - And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain a field "vpc_id" with "fakeaws" And all "network.create.aws-fake" messages should contain a field "range" with "10.2.0.0/24" + And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "up_to_16_characters_secret" And all "network.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "fake_up_to_16_characters" diff --git a/internal/features/aws/add_network.feature b/internal/features/aws/add_network.feature index 82b8661..0190446 100644 --- a/internal/features/aws/add_network.feature +++ b/internal/features/aws/add_network.feature @@ -1,9 +1,9 @@ @aws @add_network -Feature: Service apply +Feature: Environment apply Scenario: Add a new network Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws7.yml" And I start recording @@ -11,8 +11,8 @@ Feature: Service apply And I stop recording Then an event "network.create.aws-fake" should be called exactly "1" times And all "network.create.aws-fake" messages should contain a field "_provider" with "aws-fake" - And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain a field "vpc_id" with "fakeaws" And all "network.create.aws-fake" messages should contain a field "range" with "10.2.0.0/24" + And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "up_to_16_characters_secret" And all "network.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "fake_up_to_16_characters" diff --git a/internal/features/aws/add_rds_clusters.feature b/internal/features/aws/add_rds_clusters.feature index c7bd8a6..650044a 100644 --- a/internal/features/aws/add_rds_clusters.feature +++ b/internal/features/aws/add_rds_clusters.feature @@ -1,9 +1,9 @@ @aws @add_rds_clusters -Feature: Service apply +Feature: Environment apply Scenario: Adding rds clusters Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws15.yml" And I start recording diff --git a/internal/features/aws/add_rds_instances.feature b/internal/features/aws/add_rds_instances.feature index c514a5c..6b6e815 100644 --- a/internal/features/aws/add_rds_instances.feature +++ b/internal/features/aws/add_rds_instances.feature @@ -1,9 +1,9 @@ @aws @add_rds_instances -Feature: Service apply +Feature: Environment apply Scenario: Adding rds instances Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws17.yml" And I start recording diff --git a/internal/features/aws/append_instance_security_group.feature b/internal/features/aws/append_instance_security_group.feature index 214a268..2467b0f 100644 --- a/internal/features/aws/append_instance_security_group.feature +++ b/internal/features/aws/append_instance_security_group.feature @@ -1,9 +1,9 @@ @aws @append_instance_security_group -Feature: Service apply +Feature: Environment apply Scenario: Append security group to an instance Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws3.yml" And I start recording diff --git a/internal/features/aws/base.feature b/internal/features/aws/base.feature index 95cd73d..dc81814 100644 --- a/internal/features/aws/base.feature +++ b/internal/features/aws/base.feature @@ -1,18 +1,18 @@ @aws @aws_base -Feature: Service apply +Feature: Environment apply - Scenario: Applying a basic service + Scenario: Applying a basic environment Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I start recording And I apply the definition "aws1.yml" And I stop recording Then an event "network.create.aws-fake" should be called exactly "1" times And all "network.create.aws-fake" messages should contain a field "_provider" with "aws-fake" - And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain a field "vpc_id" with "fakeaws" And all "network.create.aws-fake" messages should contain a field "range" with "10.1.0.0/24" + And all "network.create.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "up_to_16_characters_secret" And all "network.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "fake_up_to_16_characters" Then an event "firewall.create.aws-fake" should be called exactly "1" times diff --git a/internal/features/aws/datacenter_update.feature b/internal/features/aws/datacenter_update.feature index 526be9c..e377a58 100644 --- a/internal/features/aws/datacenter_update.feature +++ b/internal/features/aws/datacenter_update.feature @@ -1,20 +1,20 @@ -@datacenter @datacenter_update -Feature: Update service with changed datacenter credentials +@project @project_update +Feature: Update environment with changed project credentials Scenario: Non logged user listing Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The datacenter "update_datacenter" does not exist - And The service "aws_test_update_dc" does not exist - And I run ernest with "datacenter create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region --fake update_datacenter" + And The project "update_project" does not exist + And The environment "aws_test_update_dc" does not exist + And I run ernest with "project create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region --fake update_project" And I start recording - And I run ernest with "service apply internal/definitions/update_datacenter_aws_1.yml" + And I run ernest with "environment apply internal/definitions/update_project_aws_1.yml" And I stop recording And all "instance.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "tmp_secret_up_to_16_chars" And all "instance.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "tmp_secret_access_key" - And I run ernest with "datacenter update aws --secret_access_key tmp_secret_access_key_2 --access_key_id tmp_secret_up_to_16_chars_2 update_datacenter" + And I run ernest with "project update aws --secret_access_key tmp_secret_access_key_2 --access_key_id tmp_secret_up_to_16_chars_2 update_project" And I start recording - When I run ernest with "service apply internal/definitions/update_datacenter_aws_2.yml" + When I run ernest with "environment apply internal/definitions/update_project_aws_2.yml" And I stop recording Then all "instance.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "tmp_secret_up_to_16_chars_2" And all "instance.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "tmp_secret_access_key_2" diff --git a/internal/features/aws/decrease_instances_count.feature b/internal/features/aws/decrease_instances_count.feature index e21e605..e3c30af 100644 --- a/internal/features/aws/decrease_instances_count.feature +++ b/internal/features/aws/decrease_instances_count.feature @@ -1,9 +1,9 @@ @aws @aws_decrease_instances_count -Feature: Service apply +Feature: Environment apply Scenario: Decreasing the instances count Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws2.yml" And I start recording diff --git a/internal/features/aws/delete_rds_clusters.feature b/internal/features/aws/delete_rds_clusters.feature index fb9a2c6..3a67494 100644 --- a/internal/features/aws/delete_rds_clusters.feature +++ b/internal/features/aws/delete_rds_clusters.feature @@ -1,9 +1,9 @@ @aws @delete_rds_clusters -Feature: Service apply +Feature: Environment apply Scenario: Updating rds clusters Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws20.yml" And I start recording diff --git a/internal/features/aws/delete_rds_instances.feature b/internal/features/aws/delete_rds_instances.feature index c7372bf..ebee527 100644 --- a/internal/features/aws/delete_rds_instances.feature +++ b/internal/features/aws/delete_rds_instances.feature @@ -1,9 +1,9 @@ @aws @delete_rds_instances -Feature: Service apply +Feature: Environment apply Scenario: Updating rds instances Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws19.yml" And I start recording diff --git a/internal/features/aws/increment_instances_count.feature b/internal/features/aws/increment_instances_count.feature index 1dddc36..af30a82 100644 --- a/internal/features/aws/increment_instances_count.feature +++ b/internal/features/aws/increment_instances_count.feature @@ -1,9 +1,9 @@ @aws @aws_increment_instances_count -Feature: Service apply +Feature: Environment apply Scenario: Incrementing instances count Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws1.yml" And I start recording diff --git a/internal/features/aws/remove_and_dettach_network.feature b/internal/features/aws/remove_and_dettach_network.feature index 9f78fcd..c93d713 100644 --- a/internal/features/aws/remove_and_dettach_network.feature +++ b/internal/features/aws/remove_and_dettach_network.feature @@ -1,9 +1,9 @@ @aws @remove_and_dettach_network -Feature: Service apply +Feature: Environment apply Scenario: Removing a network and its asociated instances Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws10.yml" And I start recording @@ -11,9 +11,9 @@ Feature: Service apply And I stop recording Then an event "network.delete.aws-fake" should be called exactly "1" times And all "network.delete.aws-fake" messages should contain a field "_provider" with "aws-fake" - And all "network.delete.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.delete.aws-fake" messages should contain a field "vpc_id" with "fakeaws" And all "network.delete.aws-fake" messages should contain a field "range" with "10.2.0.0/24" + And all "network.delete.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.delete.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "up_to_16_characters_secret" And all "network.delete.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "fake_up_to_16_characters" Then an event "instance.delete.aws-fake" should be called exactly "1" times diff --git a/internal/features/aws/remove_elb_and_s3.feature b/internal/features/aws/remove_elb_and_s3.feature index 41ad75b..5bc9af2 100644 --- a/internal/features/aws/remove_elb_and_s3.feature +++ b/internal/features/aws/remove_elb_and_s3.feature @@ -1,9 +1,9 @@ @aws @delete_elb_and_s3 -Feature: Service apply +Feature: Environment apply Scenario: delete an elb and an s3 Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws14.yml" And I start recording diff --git a/internal/features/aws/remove_network.feature b/internal/features/aws/remove_network.feature index 0da58d2..405673e 100644 --- a/internal/features/aws/remove_network.feature +++ b/internal/features/aws/remove_network.feature @@ -1,9 +1,9 @@ @aws @remove_network -Feature: Service apply +Feature: Environment apply Scenario: Remove a network Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws8.yml" And I start recording @@ -11,8 +11,8 @@ Feature: Service apply And I stop recording Then an event "network.delete.aws-fake" should be called exactly "1" times And all "network.delete.aws-fake" messages should contain a field "_provider" with "aws-fake" - And all "network.delete.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.delete.aws-fake" messages should contain a field "vpc_id" with "fakeaws" And all "network.delete.aws-fake" messages should contain a field "range" with "10.2.0.0/24" + And all "network.delete.aws-fake" messages should contain a field "datacenter_region" with "fake" And all "network.delete.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "up_to_16_characters_secret" And all "network.delete.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "fake_up_to_16_characters" diff --git a/internal/features/aws/remove_security_groups.feature b/internal/features/aws/remove_security_groups.feature index d6e8ec6..6ac7b55 100644 --- a/internal/features/aws/remove_security_groups.feature +++ b/internal/features/aws/remove_security_groups.feature @@ -1,9 +1,9 @@ @aws @remove_security_groups -Feature: Service apply +Feature: Environment apply Scenario: Remove security groups Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws6.yml" And I start recording diff --git a/internal/features/aws/update_elb_and_s3.feature b/internal/features/aws/update_elb_and_s3.feature index cb80b86..5db1ebf 100644 --- a/internal/features/aws/update_elb_and_s3.feature +++ b/internal/features/aws/update_elb_and_s3.feature @@ -1,9 +1,9 @@ @aws @update_elb_and_s3 -Feature: Service apply +Feature: Environment apply Scenario: Update an elb and an s3 Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws13.yml" And I start recording diff --git a/internal/features/aws/update_rds_clusters.feature b/internal/features/aws/update_rds_clusters.feature index d69ea62..f15fe79 100644 --- a/internal/features/aws/update_rds_clusters.feature +++ b/internal/features/aws/update_rds_clusters.feature @@ -1,9 +1,9 @@ @aws @update_rds_clusters -Feature: Service apply +Feature: Environment apply Scenario: Updating rds clusters Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws16.yml" And I start recording diff --git a/internal/features/aws/update_rds_instances.feature b/internal/features/aws/update_rds_instances.feature index 8ef2763..1808cd5 100644 --- a/internal/features/aws/update_rds_instances.feature +++ b/internal/features/aws/update_rds_instances.feature @@ -1,9 +1,9 @@ @aws @update_rds_instances -Feature: Service apply +Feature: Environment apply Scenario: Updating rds instances Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "aws18.yml" And I start recording diff --git a/internal/features/azure/base.feature b/internal/features/azure/base.feature index 483ee32..7c85f05 100644 --- a/internal/features/azure/base.feature +++ b/internal/features/azure/base.feature @@ -1,18 +1,18 @@ @azure @azure_base -Feature: Applying an azure based service +Feature: Applying an azure based environment - Scenario: Applying a basic azure service + Scenario: Applying a basic azure environment Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "pwd" And I start recording And I apply the definition "azure1.yml" And I stop recording Then an event "resource_group.create.azure-fake" should be called exactly "1" times And all "resource_group.create.azure-fake" messages should contain a field "_provider" with "azure-fake" - And all "resource_group.create.azure-fake" messages should contain a field "datacenter_region" with "westus" And all "resource_group.create.azure-fake" messages should contain a field "name" with "rg2" And all "resource_group.create.azure-fake" messages should contain a field "location" with "eastus" + And all "resource_group.create.azure-fake" messages should contain an encrypted field "datacenter_region" with "westus" And all "resource_group.create.azure-fake" messages should contain an encrypted field "azure_client_id" with "cliid" And all "resource_group.create.azure-fake" messages should contain an encrypted field "azure_client_secret" with "clisec" And all "resource_group.create.azure-fake" messages should contain an encrypted field "azure_subscription_id" with "subid" diff --git a/internal/features/azure/creator.feature b/internal/features/azure/creator.feature index b1c7fcc..c055ae6 100644 --- a/internal/features/azure/creator.feature +++ b/internal/features/azure/creator.feature @@ -1,9 +1,9 @@ @azure @azure_creator Feature: Creator - Scenario: Applying a basic azure service + Scenario: Applying a basic azure environment Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "pwd" And I start recording And I apply the definition "azure2.yml" @@ -197,7 +197,6 @@ Feature: Creator And message "virtual_machine.create.azure-fake" number "1" should contain "_state" as json field "running" And message "virtual_machine.create.azure-fake" number "1" should contain "vm_size" as json field "Standard_DS1_v2" And message "virtual_machine.create.azure-fake" number "1" should contain "datacenter_type" as json field "azure-fake" - And an event "group.get" should be called exactly "1" times And an event "virtual_machine.create.azure-fake.done" should be called exactly "2" times And message "virtual_machine.create.azure-fake.done" number "0" should contain "availability_set" as json field "web" And message "virtual_machine.create.azure-fake.done" number "0" should contain "type" as json field "virtual_machine.create.azure-fake.done" @@ -340,7 +339,6 @@ Feature: Creator And message "subnet.create.azure-fake.done" number "0" should contain "_state" as json field "completed" And message "subnet.create.azure-fake.done" number "0" should contain "network_security_group" as json field "subnet-sg" And message "subnet.create.azure-fake.done" number "0" should contain "network_security_group_id" as json field "$(components.#[_component_id="security_group::subnet-sg"].id)" - And an event "datacenter.find" should be called exactly "1" times And an event "lb.create.azure-fake.done" should be called exactly "1" times And message "lb.create.azure-fake.done" number "0" should contain "datacenter_region" as json field "westus" And message "lb.create.azure-fake.done" number "0" should contain "_action" as json field "create" @@ -453,8 +451,6 @@ Feature: Creator And message "virtual_machine.update.azure-fake" number "1" should contain "_state" as json field "running" And message "virtual_machine.update.azure-fake" number "1" should contain "datacenter_type" as json field "azure-fake" And message "virtual_machine.update.azure-fake" number "1" should contain "location" as json field "westeurope" - And an event "datacenter.find" should be called exactly "1" times - And an event "group.get" should be called exactly "1" times And an event "security_group.update.azure-fake.done" should be called exactly "1" times And message "security_group.update.azure-fake.done" number "0" should contain "_component" as json field "security_group" And message "security_group.update.azure-fake.done" number "0" should contain "resource_group_name" as json field "az-test" @@ -743,7 +739,6 @@ Feature: Creator And message "network_interface.delete.azure-fake.done" number "0" should contain "datacenter_type" as json field "azure-fake" And message "network_interface.delete.azure-fake.done" number "0" should contain "_action" as json field "delete" And message "network_interface.delete.azure-fake.done" number "0" should contain "_state" as json field "completed" - And an event "group.get" should be called exactly "1" times And an event "public_ip.create.azure-fake.done" should be called exactly "2" times And message "public_ip.create.azure-fake.done" number "0" should contain "datacenter_region" as json field "westus" And message "public_ip.create.azure-fake.done" number "0" should contain "datacenter_name" as json field "fakeazure" @@ -769,7 +764,6 @@ Feature: Creator And message "public_ip.create.azure-fake.done" number "1" should contain "resource_group_name" as json field "az-test" And message "public_ip.create.azure-fake.done" number "1" should contain "type" as json field "public_ip.create.azure-fake.done" And message "public_ip.create.azure-fake.done" number "1" should contain "datacenter_type" as json field "azure-fake" - And an event "datacenter.find" should be called exactly "1" times And an event "public_ip.delete.azure-fake.done" should be called exactly "1" times And message "public_ip.delete.azure-fake.done" number "0" should contain "_component_id" as json field "public_ip::web-2-config1" And message "public_ip.delete.azure-fake.done" number "0" should contain "datacenter_type" as json field "azure-fake" @@ -878,7 +872,6 @@ Feature: Creator And message "network_interface.delete.azure-fake" number "0" should contain "network_security_group_id" as json field "$(components.#[_component_id="security_group::vm-sg"].id)" And message "network_interface.delete.azure-fake" number "0" should contain "_action" as json field "delete" And message "network_interface.delete.azure-fake" number "0" should contain "resource_group_name" as json field "az-test" - And an event "group.get" should be called exactly "1" times And an event "virtual_machine.delete.azure-fake" should be called exactly "1" times And message "virtual_machine.delete.azure-fake" number "0" should contain "_state" as json field "running" And message "virtual_machine.delete.azure-fake" number "0" should contain "datacenter_region" as json field "westus" @@ -948,7 +941,6 @@ Feature: Creator And message "sql_firewall_rule.create.azure-fake.done" number "0" should contain "_component" as json field "sql_firewall_rule" And message "sql_firewall_rule.create.azure-fake.done" number "0" should contain "_state" as json field "completed" And message "sql_firewall_rule.create.azure-fake.done" number "0" should contain "datacenter_type" as json field "azure-fake" - And an event "datacenter.find" should be called exactly "1" times And an event "public_ip.delete.azure-fake" should be called exactly "1" times And message "public_ip.delete.azure-fake" number "0" should contain "datacenter_name" as json field "fakeazure" And message "public_ip.delete.azure-fake" number "0" should contain "_action" as json field "delete" @@ -1081,7 +1073,6 @@ Feature: Creator And message "lb_backend_address_pool.delete.azure-fake" number "0" should contain "loadbalancer" as json field "lb" And message "lb_backend_address_pool.delete.azure-fake" number "0" should contain "_component_id" as json field "lb_backend_address_pool::pool1" And message "lb_backend_address_pool.delete.azure-fake" number "0" should contain "_provider" as json field "azure-fake" - And an event "datacenter.find" should be called exactly "1" times And an event "definition.map.creation" should be called exactly "1" times And message "definition.map.creation" number "0" should contain "previous_id" as json field "469d51d1-9524-4dae-6fbc-b7da83b0354f-6bfc681a4807703c77135f2a72c7dc40" And an event "public_ip.create.azure-fake.done" should be called exactly "1" times @@ -1123,7 +1114,6 @@ Feature: Creator And message "availability_set.delete.azure-fake" number "0" should contain "_provider" as json field "azure-fake" And message "availability_set.delete.azure-fake" number "0" should contain "datacenter_region" as json field "westus" And message "availability_set.delete.azure-fake" number "0" should contain "_state" as json field "running" - And an event "group.get" should be called exactly "1" times And an event "public_ip.delete.azure-fake.done" should be called exactly "2" times And message "public_ip.delete.azure-fake.done" number "0" should contain "public_ip_address_allocation" as json field "static" And message "public_ip.delete.azure-fake.done" number "0" should contain "datacenter_type" as json field "azure-fake" diff --git a/internal/features/cli/authorization.feature b/internal/features/cli/authorization.feature new file mode 100644 index 0000000..c159071 --- /dev/null +++ b/internal/features/cli/authorization.feature @@ -0,0 +1,45 @@ +@authorization +Feature: Ernest authorization management + + Scenario: bla + Given I setup ernest with target "https://ernest.local" + And I'm logged in as "ci_admin" / "secret123" + And I run ernest with "user create auth secret123" + And I'm logged in as "auth" / "secret123" + And The output should contain "Welcome back auth" + When I run ernest with "project list" + Then The output should contain "There are no projects created yet." + When I run ernest with "env list" + Then The output should contain "There are no environments created yet" + When I run ernest with "project create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region auth_project" + Then The output should contain "Project 'auth_project' successfully created" + When I run ernest with "project list" + Then The output should contain "auth_project" + When I'm logged in as "ci_admin" / "secret123" + And I run ernest with "role set -u auth -r reader -p fakeaws" + When I'm logged in as "auth" / "secret123" + And I run ernest with "project list" + Then The output should contain "auth_project" + And The output should contain "fakeaws" + When I setup a new environment name "auth_env" + And I apply the definition "aws1.yml" + And I wait for "3" seconds + And The output should contain "You don't have permissions to perform this action, please login as a resource owner" + When I'm logged in as "ci_admin" / "secret123" + And I run ernest with "role set -u auth -r owner -p fakeaws" + When I'm logged in as "auth" / "secret123" + And I apply the definition "aws1.yml" + And I wait for "3" seconds + And I run ernest with "env list" + Then The output should contain "auth_env" + When I'm logged in as "usr" / "secret123" + And I run ernest with "env list" + Then The output should not contain "auth_env" + When I run ernest with "env info auth_project auth_env" + Then The output should contain "Specified environment name does not exist" + When I run ernest with "project info auth_project" + Then The output should contain "403 Forbidden" + + + + diff --git a/internal/features/cli/datacenter.feature b/internal/features/cli/datacenter.feature index 78197d4..934f35e 100644 --- a/internal/features/cli/datacenter.feature +++ b/internal/features/cli/datacenter.feature @@ -1,17 +1,17 @@ -@datacenter -Feature: Ernest datacenter +@project +Feature: Ernest project - Scenario: running "datacenter" command as logged in user + Scenario: running "project" command as logged in user Given I setup ernest with target "https://ernest.local" When I'm logged in as "usr" / "secret123" - And I run ernest with "datacenter" + And I run ernest with "project" And The output should contain "list" And The output should contain "create" - Scenario: running "datacenter" command as non logged in user + Scenario: running "project" command as non logged in user Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "group" + When I run ernest with "project" And The output should contain "list" And The output should contain "create" diff --git a/internal/features/cli/datacenter_create_aws.feature b/internal/features/cli/datacenter_create_aws.feature index 1d4063b..8f573bb 100644 --- a/internal/features/cli/datacenter_create_aws.feature +++ b/internal/features/cli/datacenter_create_aws.feature @@ -1,36 +1,36 @@ -@datacenter @datacenter_create @datacenter_create_aws -Feature: Ernest datacenter create +@project @project_create @project_create_aws +Feature: Ernest project create - Scenario: Non logged aws datacenter creation + Scenario: Non logged aws project creation Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter create aws" - Then The output should contain "You should specify the datacenter name" - When I run ernest with "datacenter create aws tmp_datacenter" + When I run ernest with "project create aws" + Then The output should contain "You should specify the project name" + When I run ernest with "project create aws tmp_project" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Logged user aws datacenter creation + Scenario: Logged user aws project creation Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter create aws" - Then The output should contain "You should specify the datacenter name" - When I run ernest with "datacenter create aws tmp_datacenter" + When I run ernest with "project create aws" + Then The output should contain "You should specify the project name" + When I run ernest with "project create aws tmp_project" Then The output should contain "Please, fix the error shown below to continue" And The output should contain "- Specify a valid secret access key with --secret_access_key flag" - When I run ernest with "datacenter create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' successfully created" - When I run ernest with "datacenter list" - Then The output should contain "tmp_datacenter" + When I run ernest with "project create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_project" + Then The output should contain "Project 'tmp_project' successfully created" + When I run ernest with "project list" + Then The output should contain "tmp_project" Then The output should contain "tmp_region" Then The output should contain "aws" - Scenario: Adding an already existing aws datacenter + Scenario: Adding an already existing aws project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_datacenter" - And I run ernest with "datacenter create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' already exists, please specify a different name" + When I run ernest with "project create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_project" + And I run ernest with "project create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_project" + Then The output should contain "Project 'tmp_project' already exists, please specify a different name" diff --git a/internal/features/cli/datacenter_create_azure.feature b/internal/features/cli/datacenter_create_azure.feature index f1ebb92..ee865ff 100644 --- a/internal/features/cli/datacenter_create_azure.feature +++ b/internal/features/cli/datacenter_create_azure.feature @@ -1,43 +1,43 @@ -@datacenter @datacenter_create @datacenter_create_azure -Feature: Ernest datacenter create +@project @project_create @project_create_azure +Feature: Ernest project create - Scenario: Non logged azure datacenter creation + Scenario: Non logged azure project creation Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter create azure" - Then The output should contain "You should specify the datacenter name" - When I run ernest with "datacenter create azure tmp_datacenter" + When I run ernest with "project create azure" + Then The output should contain "You should specify the project name" + When I run ernest with "project create azure tmp_project" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Logged user azure datacenter creation + Scenario: Logged user azure project creation Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter create azure" - Then The output should contain "You should specify the datacenter name" - When I run ernest with "datacenter create azure tmp_datacenter" + When I run ernest with "project create azure" + Then The output should contain "You should specify the project name" + When I run ernest with "project create azure tmp_project" Then The output should contain "Please, fix the error shown below to continue" And The output should contain "- Specify a valid subscription id with --subscription_id flag" - When I run ernest with "datacenter create azure --subscription_id subid tmp_datacenter" + When I run ernest with "project create azure --subscription_id subid tmp_project" Then The output should contain "Please, fix the error shown below to continue" And The output should contain "- Specify a valid client id with --client_id flag" - When I run ernest with "datacenter create azure --subscription_id subid --client_id cliid tmp_datacenter" + When I run ernest with "project create azure --subscription_id subid --client_id cliid tmp_project" Then The output should contain "Please, fix the error shown below to continue" And The output should contain "- Specify a valid region with --region flag" - When I run ernest with "datacenter create azure --subscription_id subid --client_id cliid --region westus tmp_datacenter" + When I run ernest with "project create azure --subscription_id subid --client_id cliid --region westus tmp_project" Then The output should contain "Please, fix the error shown below to continue" And The output should contain "- Specify a valid tenant id with --tenant_id flag" - When I run ernest with "datacenter create azure --subscription_id subid --client_id cliid --region westus --tenant_id tenid tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' successfully created" - When I run ernest with "datacenter list" - Then The output should contain "tmp_datacenter" - Then The output should contain "tmp_region" + When I run ernest with "project create azure --subscription_id subid --client_id cliid --region westus --tenant_id tenid tmp_project" + Then The output should contain "Project 'tmp_project' successfully created" + When I run ernest with "project list" + Then The output should contain "tmp_project" + Then The output should contain "westus" Then The output should contain "azure" - Scenario: Adding an already existing azure datacenter + Scenario: Adding an already existing azure project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter create azure --subscription_id subid --client_id cliid --region westus --tenant_id tenid tmp_datacenter" - And I run ernest with "datacenter create azure --subscription_id subid --client_id cliid --region westus --tenant_id tenid tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' already exists, please specify a different name" + When I run ernest with "project create azure --subscription_id subid --client_id cliid --region westus --tenant_id tenid tmp_project" + And I run ernest with "project create azure --subscription_id subid --client_id cliid --region westus --tenant_id tenid tmp_project" + Then The output should contain "Project 'tmp_project' already exists, please specify a different name" diff --git a/internal/features/cli/datacenter_create_vcloud.feature b/internal/features/cli/datacenter_create_vcloud.feature index 8e63422..3b9b5c3 100644 --- a/internal/features/cli/datacenter_create_vcloud.feature +++ b/internal/features/cli/datacenter_create_vcloud.feature @@ -1,43 +1,43 @@ -@datacenter @datacenter_create @datacenter_create_vcloud -Feature: Ernest datacenter create +@project @project_create @project_create_vcloud +Feature: Ernest project create - Scenario: Non logged vcloud datacenter creation + Scenario: Non logged vcloud project creation Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter create vcloud" - Then The output should contain "You should specify the datacenter name" - When I run ernest with "datacenter create vcloud tmp_datacenter" + When I run ernest with "project create vcloud" + Then The output should contain "You should specify the project name" + When I run ernest with "project create vcloud tmp_project" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Logged user vcloud datacenter creation + Scenario: Logged user vcloud project creation Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter create vcloud" - Then The output should contain "You should specify the datacenter name" - When I run ernest with "datacenter create vcloud tmp_datacenter" + When I run ernest with "project create vcloud" + Then The output should contain "You should specify the project name" + When I run ernest with "project create vcloud tmp_project" Then The output should contain "Please, fix the error shown below to continue" And The output should contain "- Specify a valid VCloud URL with --vcloud-url flag" And The output should contain "- Specify a valid public network with --public-network flag" And The output should contain "- Specify a valid user name with --user" And The output should contain "- Specify a valid organization with --org" And The output should contain "- Specify a valid password with --password" - When I run ernest with "datacenter create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' successfully created" - When I run ernest with "datacenter list" - Then The output should contain "tmp_datacenter" + When I run ernest with "project create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_project" + Then The output should contain "Project 'tmp_project' successfully created" + When I run ernest with "project list" + Then The output should contain "tmp_project" Then The output should contain "test" Then The output should contain "vcloud" Then The output should contain "https://myernest.com" Then The output should contain "MY-PUBLIC-NETWORK" Then The output should contain "MY-ORG-NAME" - Scenario: Adding an already existing vcloud datacenter + Scenario: Adding an already existing vcloud project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_datacenter" - And I run ernest with "datacenter create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' already exists, please specify a different name" + When I run ernest with "project create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_project" + And I run ernest with "project create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_project" + Then The output should contain "Project 'tmp_project' already exists, please specify a different name" diff --git a/internal/features/cli/datacenter_delete.feature b/internal/features/cli/datacenter_delete.feature index 8ae2d0c..57c02dd 100644 --- a/internal/features/cli/datacenter_delete.feature +++ b/internal/features/cli/datacenter_delete.feature @@ -1,41 +1,41 @@ -@datacenter @datacenter_delete -Feature: Ernest datacenter create +@project @project_delete +Feature: Ernest project create - Scenario: Non logged vcloud datacenter creation + Scenario: Non logged vcloud project creation Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter delete" + When I run ernest with "project delete" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Deleting an existing datacenter + Scenario: Deleting an existing project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - And I run ernest with "datacenter create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_datacenter" - And I run ernest with "datacenter list" - And The output should contain "tmp_datacenter" - When I run ernest with "datacenter delete tmp_datacenter" - Then The output should contain "Datacenter tmp_datacenter successfully removed" - And I run ernest with "datacenter list" - And The output should not contain "tmp_datacenter" + And I run ernest with "project create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_project" + And I run ernest with "project list" + And The output should contain "tmp_project" + When I run ernest with "project delete tmp_project" + Then The output should contain "Project tmp_project successfully removed" + And I run ernest with "project list" + And The output should not contain "tmp_project" - Scenario: Deleting an unexisting datacenter + Scenario: Deleting an unexisting project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter delete tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' does not exist, please specify a different datacenter name" + When I run ernest with "project delete tmp_project" + Then The output should contain "Project 'tmp_project' does not exist, please specify a different project name" - Scenario: Deleting an existing datacenter with related services + Scenario: Deleting an existing project with related environments Given I setup ernest with target "https://ernest.local" - And I setup a new service name - And the datacenter "test_dc" does not exist + And I setup a new environment name + And the project "test_dc" does not exist And I'm logged in as "usr" / "secret123" - And I run ernest with "datacenter create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region --fake test_dc" - Then The output should contain "Datacenter 'test_dc' successfully created" - And The service "aws_test_service" does not exist + And I run ernest with "project create aws --secret_access_key tmp_secret_access_key --access_key_id tmp_secret_up_to_16_chars --region tmp_region --fake test_dc" + Then The output should contain "Project 'test_dc' successfully created" + And The environment "aws_test_environment" does not exist When I apply the definition "referenced.yml" - And I run ernest with "datacenter list" + And I run ernest with "project list" And The output should contain "test_dc" - And I run ernest with "datacenter delete test_dc" - Then The output should contain "Existing services are referring to this datacenter." + And I run ernest with "project delete test_dc" + Then The output should contain "Existing environments are referring to this project." diff --git a/internal/features/cli/datacenter_list.feature b/internal/features/cli/datacenter_list.feature index cb3dc41..a315a04 100644 --- a/internal/features/cli/datacenter_list.feature +++ b/internal/features/cli/datacenter_list.feature @@ -1,23 +1,23 @@ -@datacenter @datacenter_list -Feature: Ernest datacenter list +@project @project_list +Feature: Ernest project list Scenario: Non logged user listing Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter list" + When I run ernest with "project list" Then The output should contain "You're not allowed to perform this action, please log in" Scenario: Logged user listing Given I setup ernest with target "https://ernest.local" When I'm logged in as "usr" / "secret123" - And I run ernest with "datacenter list" + And I run ernest with "project list" Then The output should contain "fake" And The output should contain "fakeaws" Scenario: Admin user listing Given I setup ernest with target "https://ernest.local" When I'm logged in as "ci_admin" / "secret123" - And I run ernest with "datacenter list" + And I run ernest with "project list" Then The output should contain "fake" Then The output should contain "test" And The output should contain "fakeaws" @@ -25,14 +25,13 @@ Feature: Ernest datacenter list Scenario: Listing fields Given I setup ernest with target "https://ernest.local" When I'm logged in as "usr" / "secret123" - And I run ernest with "datacenter list" - Then The output should contain "VCloud Datacenters" - Then The output should contain "AWS Datacenters" + And I run ernest with "project list" + Then The output should contain "VCloud Projects" + Then The output should contain "AWS Projects" And The output should contain "fake" And The output should contain "fakeaws" And The output should contain "NAME" And The output should contain "ID" - And The output should contain "GROUP" And The output should contain "EXTERNAL NETWORK" And The output should contain "ORG" And The output should contain "URL" diff --git a/internal/features/cli/datacenter_update_aws.feature b/internal/features/cli/datacenter_update_aws.feature index d2171ec..d3c935a 100644 --- a/internal/features/cli/datacenter_update_aws.feature +++ b/internal/features/cli/datacenter_update_aws.feature @@ -1,26 +1,26 @@ -@datacenter @datacenter_update @datacenter_update_aws -Feature: Ernest aws datacenter update +@project @project_update @project_update_aws +Feature: Ernest aws project update - Scenario: Non logged aws datacenter creation + Scenario: Non logged aws project creation Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter update aws" + When I run ernest with "project update aws" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Updating an existing aws datacenter + Scenario: Updating an existing aws project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - And I run ernest with "datacenter create aws --secret_access_key tmp_secret_access_key_up_to_16_chars --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_datacenter" - And I run ernest with "datacenter list" - And The output should contain "tmp_datacenter" - When I run ernest with "datacenter update aws tmp_datacenter --secret_access_key tmp_secret_access_key_up_to_16_chars --access_key_id tmp_secret_up_to_16_chars" - Then The output should contain "Datacenter tmp_datacenter successfully updated" - And The aws datacenter "tmp_datacenter" credentials should be "tmp_secret_up_to_16_chars" and "tmp_secret_access_key_up_to_16_chars" + And I run ernest with "project create aws --secret_access_key tmp_secret_access_key_up_to_16_chars --access_key_id tmp_secret_up_to_16_chars --region tmp_region tmp_project" + And I run ernest with "project list" + And The output should contain "tmp_project" + When I run ernest with "project update aws tmp_project --secret_access_key tmp_secret_access_key_up_to_16_chars --access_key_id tmp_secret_up_to_16_chars" + Then The output should contain "Project tmp_project successfully updated" + And The aws project "tmp_project" credentials should be "tmp_secret_up_to_16_chars" and "tmp_secret_access_key_up_to_16_chars" - Scenario: Updating an unexisting aws datacenter + Scenario: Updating an unexisting aws project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter update aws tmp_datacenter --secret_access_key very_large_aws_token_string --access_key_id secret" - Then The output should contain "Datacenter 'tmp_datacenter' does not exist, please specify a different datacenter name" + When I run ernest with "project update aws tmp_project --secret_access_key very_large_aws_token_string --access_key_id secret" + Then The output should contain "Project 'tmp_project' does not exist, please specify a different project name" diff --git a/internal/features/cli/datacenter_update_azure.feature b/internal/features/cli/datacenter_update_azure.feature index c59f8b0..b79bd31 100644 --- a/internal/features/cli/datacenter_update_azure.feature +++ b/internal/features/cli/datacenter_update_azure.feature @@ -1,26 +1,26 @@ -@datacenter @datacenter_update @datacenter_update_azure -Feature: Ernest azure datacenter update +@project @project_update @project_update_azure +Feature: Ernest azure project update - Scenario: Non logged azure datacenter creation + Scenario: Non logged azure project creation Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter update azure" + When I run ernest with "project update azure" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Updating an existing azure datacenter + Scenario: Updating an existing azure project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter create azure --subscription_id subid --client_id cliid --client_secret secret --region westus --tenant_id tenid --environment public tmp_datacenter" - And I run ernest with "datacenter list" - And The output should contain "tmp_datacenter" - When I run ernest with "datacenter update azure --subscription_id u_subid --client_id u_cliid --client_secret secret --tenant_id u_tenid --environment u_public tmp_datacenter" - Then The output should contain "Datacenter tmp_datacenter successfully updated" - And The azure datacenter "tmp_datacenter" credentials should be "u_subid", "u_cliid", "secret", "u_tenid" and "u_public" + When I run ernest with "project create azure --subscription_id subid --client_id cliid --client_secret secret --region westus --tenant_id tenid --environment public tmp_project" + And I run ernest with "project list" + And The output should contain "tmp_project" + When I run ernest with "project update azure --subscription_id u_subid --client_id u_cliid --client_secret secret --tenant_id u_tenid --environment u_public tmp_project" + Then The output should contain "Project tmp_project successfully updated" + And The azure project "tmp_project" credentials should be "u_subid", "u_cliid", "secret", "u_tenid" and "u_public" - Scenario: Updating an unexisting azure datacenter + Scenario: Updating an unexisting azure project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter update azure --subscription_id u_subid --client_id u_cliid --client_secret secret --tenant_id u_tenid --environment u_public tmp_datacenter" - Then The output should contain "Datacenter 'tmp_datacenter' does not exist, please specify a different datacenter name" + When I run ernest with "project update azure --subscription_id u_subid --client_id u_cliid --client_secret secret --tenant_id u_tenid --environment u_public tmp_project" + Then The output should contain "Project 'tmp_project' does not exist, please specify a different project name" diff --git a/internal/features/cli/datacenter_update_vcloud.feature b/internal/features/cli/datacenter_update_vcloud.feature index 5a0ecf9..f12c00d 100644 --- a/internal/features/cli/datacenter_update_vcloud.feature +++ b/internal/features/cli/datacenter_update_vcloud.feature @@ -1,25 +1,25 @@ -@datacenter @datacenter_update @datacenter_update_vcloud -Feature: Ernest vcloud datacenter update +@project @project_update @project_update_vcloud +Feature: Ernest vcloud project update - Scenario: Non logged vcloud datacenter creation + Scenario: Non logged vcloud project creation Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "datacenter update vcloud" + When I run ernest with "project update vcloud" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Updating an existing vcloud datacenter + Scenario: Updating an existing vcloud project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - And I run ernest with "datacenter create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_datacenter" - And I run ernest with "datacenter list" - And The output should contain "tmp_datacenter" - When I run ernest with "datacenter update vcloud tmp_datacenter --user me --org MY-NEW-ORG --password secret" - Then The output should contain "Datacenter tmp_datacenter successfully updated" + And I run ernest with "project create vcloud --user usr --password xxxx --org MY-ORG-NAME --vse-url http://vse.url --vcloud-url https://myernest.com --public-network MY-PUBLIC-NETWORK tmp_project" + And I run ernest with "project list" + And The output should contain "tmp_project" + When I run ernest with "project update vcloud tmp_project --user me --org MY-NEW-ORG --password secret" + Then The output should contain "Project tmp_project successfully updated" - Scenario: Updating an unexisting vcloud datacenter + Scenario: Updating an unexisting vcloud project Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist + And the project "tmp_project" does not exist And I'm logged in as "usr" / "secret123" - When I run ernest with "datacenter update vcloud tmp_datacenter --user me --org MY-NEW-ORG --password secret" - Then The output should contain "Datacenter 'tmp_datacenter' does not exist, please specify a different datacenter name" + When I run ernest with "project update vcloud tmp_project --user me --org MY-NEW-ORG --password secret" + Then The output should contain "Project 'tmp_project' does not exist, please specify a different project name" diff --git a/internal/features/cli/datacenters_to_groups.feature b/internal/features/cli/datacenters_to_groups.feature deleted file mode 100644 index 279250b..0000000 --- a/internal/features/cli/datacenters_to_groups.feature +++ /dev/null @@ -1,76 +0,0 @@ -@group @datacenters_to_groups -Feature: Ernest datacenters to groups - - Scenario: Non logged - datacenter to group - Given I setup ernest with target "https://ernest.local" - And I logout - When I run ernest with "group add-datacenter" - Then The output should contain "You should specify the datacenter name and group name" - When I run ernest with "group add-datacenter tmp_datacenter" - Then The output should contain "You should specify the group name" - When I run ernest with "group add-datacenter tmp_datacenter tmp_group" - Then The output should contain "You're not allowed to perform this action, please log in" - - Scenario: Plain datacenter - datacenter to group - Given I setup ernest with target "https://ernest.local" - And I'm logged in as "usr" / "secret123" - When I run ernest with "group add-datacenter" - Then The output should contain "You should specify the datacenter name and group name" - When I run ernest with "group add-datacenter tmp_datacenter" - Then The output should contain "You should specify the group name" - When I run ernest with "group add-datacenter tmp_datacenter tmp_group" - Then The output should contain "You don't have permissions to perform this action" - - Scenario: Admin datacenter - datacenter to group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" exists - And the datacenter "tmp_datacenter" exists - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group add-datacenter" - Then The output should contain "You should specify the datacenter name and group name" - When I run ernest with "group add-datacenter tmp_datacenter" - Then The output should contain "You should specify the group name" - When I run ernest with "group add-datacenter tmp_datacenter tmp_group" - Then The output should contain "Datacenter 'tmp_datacenter' is now assigned to group 'tmp_group'" - When I run ernest with "datacenter list" - Then The output datacenters table should contain "tmp_datacenter" assigned to "tmp_group" group - - Scenario: Already assigned datacenter - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" exists - And the datacenter "tmp_datacenter" exists - And I'm logged in as "ci_admin" / "secret123" - And I run ernest with "group add-datacenter tmp_datacenter tmp_group" - When I run ernest with "group add-datacenter tmp_datacenter tmp_group" - Then The output should contain "Datacenter 'tmp_datacenter' already belongs to 'tmp_group' group" - - Scenario: Unexisting group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" does not exist - And the datacenter "tmp_datacenter" exists - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group add-datacenter tmp_datacenter tmp_group" - Then The output should contain "Group 'tmp_group' does not exist" - - Scenario: Unexisting datacenter - Given I setup ernest with target "https://ernest.local" - And the datacenter "tmp_datacenter" does not exist - And the group "tmp_group" exists - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group add-datacenter tmp_datacenter tmp_group" - Then The output should contain "Datacenter 'tmp_datacenter' does not exist" - - Scenario: Admin datacenter - remove datacenter from group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" exists - And the datacenter "tmp_datacenter" exists - And I'm logged in as "ci_admin" / "secret123" - And I run ernest with "group add-datacenter tmp_datacenter tmp_group" - When I run ernest with "group remove-datacenter" - Then The output should contain "You should specify the datacenter name and group name" - When I run ernest with "group remove-datacenter tmp_datacenter" - Then The output should contain "You should specify the group name" - When I run ernest with "group remove-datacenter tmp_datacenter tmp_group" - Then The output should contain "Datacenter 'tmp_datacenter' is not assigned anymore to group 'tmp_group'" - When I run ernest with "datacenter list" - Then The output datacenters table should contain "tmp_datacenter" assigned to " " group diff --git a/internal/features/cli/dry.feature b/internal/features/cli/dry.feature index 85b744a..3fa9aaa 100644 --- a/internal/features/cli/dry.feature +++ b/internal/features/cli/dry.feature @@ -1,9 +1,9 @@ @cli @apply_dry Feature: Applying with dry option - Scenario: Applying a basic azure service + Scenario: Applying a basic azure environment Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "azure1.yml" with dry option Then The output should contain "Applying this definition will:" diff --git a/internal/features/cli/environment_credentials.feature b/internal/features/cli/environment_credentials.feature new file mode 100644 index 0000000..a2955de --- /dev/null +++ b/internal/features/cli/environment_credentials.feature @@ -0,0 +1,52 @@ +@cli @env_credentials +Feature: Environment credentials + + Scenario: Override project credentials at an environment level with create + Given I setup ernest with target "https://ernest.local" + And I setup a new environment name + And I'm logged in as "usr" / "secret123" + And I run ernest with "environment create fakeaws $(name) --secret_access_key tmp_secret_access_key_2 --access_key_id tmp_secret_up_to_16_chars_2" + And I start recording + And I apply the definition "aws1.yml" + And I stop recording + Then all "instance.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "tmp_secret_up_to_16_chars_2" + And all "instance.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "tmp_secret_access_key_2" + + Scenario: Override project credentials at an environment level with create + Given I setup ernest with target "https://ernest.local" + And I setup a new environment name + And I'm logged in as "usr" / "secret123" + And I run ernest with "environment create fakeaws $(name)" + And I run ernest with "environment update fakeaws $(name) --secret_access_key tmp_secret_access_key_2 --access_key_id tmp_secret_up_to_16_chars_2" + And I start recording + And I apply the definition "aws1.yml" + And I stop recording + Then all "instance.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "tmp_secret_up_to_16_chars_2" + + Scenario: Override project credentials at an environment level with apply + Given I setup ernest with target "https://ernest.local" + And I setup a new environment name + And I'm logged in as "usr" / "secret123" + And I start recording + And I apply "aws1.yml" with "--secret_access_key tmp_secret_access_key_2 --access_key_id tmp_secret_up_to_16_chars_2" + And I stop recording + Then all "instance.create.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "tmp_secret_up_to_16_chars_2" + And all "instance.create.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "tmp_secret_access_key_2" + + Scenario: Override environment credentials with update + Given I setup ernest with target "https://ernest.local" + And The environment "tmp_cred_update" does not exist + And I setup a new environment name "tmp_cred_update" + And I'm logged in as "usr" / "secret123" + And I apply the definition "aws8.yml" + When I run ernest with "env update fakeaws tmp_cred_update --secret_access_key tmp_secret_access_key_upd --access_key_id tmp_secret_up_to_16_chars_upd" + And I start recording + And I apply the definition "aws9.yml" + And I stop recording + Then all "network.delete.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "tmp_secret_up_to_16_chars_upd" + And all "network.delete.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "tmp_secret_access_key_upd" + And I start recording + And I run ernest with "env delete -y fakeaws tmp_cred_update" + And I stop recording + Then all "firewall.delete.aws-fake" messages should contain an encrypted field "aws_access_key_id" with "tmp_secret_up_to_16_chars_upd" + And all "firewall.delete.aws-fake" messages should contain an encrypted field "aws_secret_access_key" with "tmp_secret_access_key_upd" diff --git a/internal/features/cli/group.feature b/internal/features/cli/group.feature deleted file mode 100644 index 4c7d84a..0000000 --- a/internal/features/cli/group.feature +++ /dev/null @@ -1,27 +0,0 @@ -@group -Feature: Ernest group - - Scenario: running "group" command as logged in user - Given I setup ernest with target "https://ernest.local" - When I'm logged in as "usr" / "secret123" - And I run ernest with "group" - Then The output should contain "delete" - And The output should contain "list" - And The output should contain "create" - And The output should contain "add-user" - And The output should contain "remove-user" - And The output should contain "add-datacenter" - And The output should contain "remove-datacenter" - - Scenario: running "group" command as non logged in user - Given I setup ernest with target "https://ernest.local" - And I logout - When I run ernest with "group" - Then The output should contain "delete" - And The output should contain "list" - And The output should contain "create" - And The output should contain "add-user" - And The output should contain "remove-user" - And The output should contain "add-datacenter" - And The output should contain "remove-datacenter" - diff --git a/internal/features/cli/group_create.feature b/internal/features/cli/group_create.feature deleted file mode 100644 index 58761ea..0000000 --- a/internal/features/cli/group_create.feature +++ /dev/null @@ -1,37 +0,0 @@ -@group @group_create -Feature: Ernest group create - - Scenario: Non logged group creation - Given I setup ernest with target "https://ernest.local" - And I logout - When I run ernest with "group create" - Then The output should contain "You should specify the group name" - When I run ernest with "group create tmp_group" - Then The output should contain "You're not allowed to perform this action, please log in" - - Scenario: Plain user group creation - Given I setup ernest with target "https://ernest.local" - And I'm logged in as "usr" / "secret123" - When I run ernest with "group create" - Then The output should contain "You should specify the group name" - When I run ernest with "group create tmp_group" - Then The output should contain "You don't have permissions to perform this action" - - Scenario: Admin user group creation - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" does not exist - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group create" - Then The output should contain "You should specify the group name" - When I run ernest with "group create tmp_group" - Then The output should contain "Group 'tmp_group' successfully created, you can add users with 'ernest group add-user username tmp_group'" - - Scenario: Adding an already existing group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" does not exist - And I'm logged in as "ci_admin" / "secret123" - And I run ernest with "group create tmp_group" - When I run ernest with "group create tmp_group" - Then The output should contain "Group 'tmp_group' already exists, please specify a different group name" - - diff --git a/internal/features/cli/group_delete.feature b/internal/features/cli/group_delete.feature deleted file mode 100644 index 06c3973..0000000 --- a/internal/features/cli/group_delete.feature +++ /dev/null @@ -1,35 +0,0 @@ -@group @group_delete -Feature: Ernest group delete - - Scenario: Non logged group deletion - Given I setup ernest with target "https://ernest.local" - And I logout - When I run ernest with "group delete" - Then The output should contain "You should specify the group name" - When I run ernest with "group delete tmp_group" - Then The output should contain "You're not allowed to perform this action, please log in" - - Scenario: Plain user group deletion - Given I setup ernest with target "https://ernest.local" - When I'm logged in as "usr" / "secret123" - When I run ernest with "group delete" - Then The output should contain "You should specify the group name" - When I run ernest with "group delete tmp_group" - Then The output should contain "You don't have permissions to perform this action" - - Scenario: Admin user group deletion - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" does not exist - And I'm logged in as "ci_admin" / "secret123" - And I run ernest with "group create tmp_group" - When I run ernest with "group delete tmp_group" - Then The output should contain "Group 'tmp_group' successfully deleted" - - Scenario: Deleting a non existing group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" does not exist - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group delete tmp_group" - Then The output should contain "Group 'tmp_group' does not exist, please specify a different group name" - - diff --git a/internal/features/cli/group_list.feature b/internal/features/cli/group_list.feature deleted file mode 100644 index 0046163..0000000 --- a/internal/features/cli/group_list.feature +++ /dev/null @@ -1,24 +0,0 @@ -@group -Feature: Ernest group list - - Scenario: Non logged user listing - Given I setup ernest with target "https://ernest.local" - And I logout - When I run ernest with "group list" - Then The output should contain "You're not allowed to perform this action, please log in" - - Scenario: Logged user listing - Given I setup ernest with target "https://ernest.local" - When I'm logged in as "usr" / "secret123" - And I run ernest with "group list" - Then The output should contain "test" - And The output should not contain "ci_admin" - - Scenario: Admin user listing - Given I setup ernest with target "https://ernest.local" - When I'm logged in as "ci_admin" / "secret123" - And I run ernest with "group list" - Then The output should contain "test" - And The output should contain "ci_admin" - - diff --git a/internal/features/cli/info.feature b/internal/features/cli/info.feature index da7d298..47c3d17 100644 --- a/internal/features/cli/info.feature +++ b/internal/features/cli/info.feature @@ -1,13 +1,19 @@ @info Feature: Ernest info - Scenario: A user gets info about current ernest instance + Scenario: An authenticated user gets info about the ernest instance Given I setup ernest with target "http://ernest.local" And I'm logged in as "usr" / "secret123" When I run ernest with "info" - Then The output should contain regex "http://ernest.local|http(s?)://127.0.0.1" - And The output should contain "Current user : usr" - When I logout - And I run ernest with "info" - Then The output should contain regex "http://ernest.local|http(s?)://127.0.0.1" - And The output should not contain "Current user : usr" + Then The output should contain regex "Target: http://ernest.local|http(s?)://127.0.0.1" + And The output should contain "User: usr" + And The output should contain regex "CLI Version: \d*\.\d*\.\d*" + + Scenario: An unauthenticated user gets info about the ernest instance + Given I setup ernest with target "http://ernest.local" +# And I'm logged in as "usr" / "secret123" + And I logout + When I run ernest with "info" + Then The output should contain regex "Target: http://ernest.local|http(s?)://127.0.0.1" + And The output should not contain "User: usr" + And The output should contain regex "CLI Version: \d*\.\d*\.\d*" diff --git a/internal/features/cli/login.feature b/internal/features/cli/login.feature index 464a01d..71249f8 100644 --- a/internal/features/cli/login.feature +++ b/internal/features/cli/login.feature @@ -14,7 +14,7 @@ Feature: Ernest login Scenario: Login with non existing user When I'm logged in as "unexisting" / "secret123" - Then The output should contain "The keypair user / password does not match any user on the database, please try again" + Then The output should contain "Authentication failed" Scenario: Login with no username When I'm logged in as "" / "invalid123" diff --git a/internal/features/cli/logout.feature b/internal/features/cli/logout.feature index 0ed2ab2..3244816 100644 --- a/internal/features/cli/logout.feature +++ b/internal/features/cli/logout.feature @@ -8,7 +8,7 @@ Feature: Ernest logout Then The output should contain "Bye." When I run ernest with "info" Then The output should not contain "usr" - When I run ernest with "group list" + When I run ernest with "user list" Then The output should contain "You're not allowed to perform this action, please log in" Scenario: Logout non logged in user diff --git a/internal/features/cli/roles.feature b/internal/features/cli/roles.feature new file mode 100644 index 0000000..ec13b4b --- /dev/null +++ b/internal/features/cli/roles.feature @@ -0,0 +1,48 @@ +@roles +Feature: Ernest role management + + Scenario: Non logged role creation + Given I setup ernest with target "https://ernest.local" + And I logout + When I run ernest with "role set" + Then The output should contain "Please provide a role with --role flag" + When I run ernest with "role set --role owner" + Then The output should contain "Please provide a user with --user flag" + When I run ernest with "role set --role owner --user roler" + Then The output should contain "Please provide a project with --project flag" + When I run ernest with "role set --role owner --user roler --project test_project" + Then The output should contain "You're not allowed to perform this action, please log in" + When I run ernest with "role set --role owner --user roler --project test_project --environment test_environment" + Then The output should contain "You're not allowed to perform this action, please log in" + + Scenario: Plain user role creation for a project + Given I setup ernest with target "https://ernest.local" + And I'm logged in as "usr" / "secret123" + And the project "tmp_project" does not exist + And I run ernest with "project create aws tmp_project --region fake --secret_access_key fake_up_to_16_characters --access_key_id up_to_16_characters_secret --fake" + When I run ernest with "role set --role reader --user ci_admin --project tmp_project" + Then The output should contain "User 'ci_admin' has been authorized to read resource tmp_project" + And I run ernest with "project info tmp_project" + Then The output should contain "usr (owner)" + And The output should contain "ci_admin (reader)" + When I run ernest with "role unset --role reader --user ci_admin --project tmp_project" + Then The output should contain "User 'ci_admin' has been unauthorized as tmp_project reader" + And I run ernest with "project info tmp_project" + Then The output should contain "usr (owner)" + And The output should not contain "ci_admin (reader)" + + Scenario: Plain user role creation for an environment + Given I setup ernest with target "https://ernest.local" + And I'm logged in as "usr" / "secret123" + And I apply the definition "destroyable.yml" + When I run ernest with "role set --role reader --user ci_admin --project fakeaws --environment destroyable" + Then The output should contain "User 'ci_admin' has been authorized to read resource fakeaws / destroyable" + And I run ernest with "env info fakeaws destroyable" + Then The output should contain "usr (owner)" + And The output should contain "ci_admin (reader)" + When I run ernest with "role unset --role reader --user ci_admin --project fakeaws --environment destroyable" + Then The output should contain "User 'ci_admin' has been unauthorized as fakeaws / destroyable reader" + And I run ernest with "env info fakeaws destroyable" + Then The output should contain "usr (owner)" + And The output should not contain "ci_admin (reader)" + diff --git a/internal/features/cli/service.feature b/internal/features/cli/service.feature index 673b134..9e79b10 100644 --- a/internal/features/cli/service.feature +++ b/internal/features/cli/service.feature @@ -1,10 +1,10 @@ -@service -Feature: Ernest service +@environment +Feature: Ernest environment - Scenario: running "service" command as logged in user + Scenario: running "environment" command as logged in user Given I setup ernest with target "https://ernest.local" When I'm logged in as "usr" / "secret123" - And I run ernest with "service" + And I run ernest with "environment" And The output should contain "list" And The output should contain "apply" And The output should contain "destroy" @@ -14,10 +14,10 @@ Feature: Ernest service And The output should contain "info" And The output should contain "monitor" - Scenario: running "service" command as non logged in user + Scenario: running "environment" command as non logged in user Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service" + When I run ernest with "environment" And The output should contain "list" And The output should contain "list" And The output should contain "apply" diff --git a/internal/features/cli/service_apply.feature b/internal/features/cli/service_apply.feature index be42ab5..1f9f6da 100644 --- a/internal/features/cli/service_apply.feature +++ b/internal/features/cli/service_apply.feature @@ -1,32 +1,32 @@ -@service @service_apply -Feature: Service apply +@environment @environment_apply +Feature: Environment apply - Scenario: Non logged service apply + Scenario: Non logged environment apply Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service apply" + When I run ernest with "environment apply" Then The output should contain "You're not allowed to perform this action, please log in" - When I run ernest with "service apply definitions/aws1.yml" + When I run ernest with "environment apply definitions/aws1.yml" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Logged service apply errors + Scenario: Logged environment apply errors Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - When I run ernest with "service apply" + When I run ernest with "environment apply" Then The output should contain "You should specify a valid template path or store an ernest.yml on the current folder" - When I run ernest with "service apply internal/definitions/unexisting_dc.yml" - Then The output should contain "Specified datacenter does not exist" + When I run ernest with "environment apply internal/definitions/unexisting_dc.yml" + Then The output should contain "Specified project does not exist" - Scenario: Logged service apply + Scenario: Logged environment apply Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "aws_test_service" does not exist + And The environment "aws_test_environment" does not exist When I apply the definition "aws1.yml" Then The output should contain "Status: Applied" - Scenario: Logged service apply with internal file references + Scenario: Logged environment apply with internal file references Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "aws_test_service" does not exist + And The environment "aws_test_environment" does not exist When I apply the definition "aws-template1-unexisting.yml" Then The output should contain "Can't access referenced file" diff --git a/internal/features/cli/service_definition.feature b/internal/features/cli/service_definition.feature index 34fd97f..e1da6e0 100644 --- a/internal/features/cli/service_definition.feature +++ b/internal/features/cli/service_definition.feature @@ -1,29 +1,31 @@ -@service @service_definition -Feature: Ernest service definition +@environment @environment_definition +Feature: Ernest environment definition Scenario: Non logged user definition Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service definition" + When I run ernest with "env definition" Then The output should contain "You're not allowed to perform this action, please log in" Scenario: Logged user definition Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "destroyable" does not exist + And The environment "destroyable" does not exist And I apply the definition "destroyable.yml" - When I run ernest with "service definition" - Then The output should contain "You should specify the service name" - When I run ernest with "service definition destroyable" + When I run ernest with "env definition" + Then The output should contain "You should specify the project name" + When I run ernest with "env definition fakeaws" + Then The output should contain "You should specify the env name" + When I run ernest with "env definition fakeaws destroyable" Then The output should contain "name: destroyable" - And The output should contain "datacenter: fakeaws" + And The output should contain "project: fakeaws" Scenario: Logged user definition for a specific build Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "destroyable" does not exist + And The environment "destroyable" does not exist And I apply the definition "destroyable.yml" - When I run ernest with "service definition destroyable" + When I run ernest with "env definition fakeaws destroyable" Then The output should contain "name: destroyable" - And The output should contain "datacenter: fakeaws" + And The output should contain "project: fakeaws" diff --git a/internal/features/cli/service_destroy.feature b/internal/features/cli/service_destroy.feature index ef7e28b..59b4c72 100644 --- a/internal/features/cli/service_destroy.feature +++ b/internal/features/cli/service_destroy.feature @@ -1,29 +1,33 @@ -@service @service_destroy -Feature: Service destroy +@environment @environment_destroy +Feature: Environment destroy - Scenario: Non logged service destroy + Scenario: Non logged environment destroy Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service destroy" + When I run ernest with "env destroy" Then The output should contain "You're not allowed to perform this action, please log in" - When I run ernest with "service destroy destroyable" + When I run ernest with "env destroy fakeaws destroyable" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Logged service destroy unexisting + Scenario: Logged environment destroy unexisting Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - When I run ernest with "service destroy" - Then The output should contain "You should specify an existing service name" - When I run ernest with "service destroy unexisting --yes" - Then The output should contain "Specified service name does not exist" + And The environment "fakeaws/unexisting" does not exist + When I run ernest with "env destroy" + Then The output should contain "You should specify an existing project name" + When I run ernest with "env destroy fakeaws" + Then The output should contain "You should specify an existing project environment" + When I run ernest with "env destroy fakeaws unexisting --yes" + Then The output should contain "Specified environment name does not exist" - Scenario: Logged service destroy + Scenario: Logged environment destroy Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "destroyable" does not exist + And The environment "fakeaws/destroyable" does not exist And I apply the definition "destroyable.yml" - When I run ernest with "service destroy destroyable --yes" - Then The output should not contain "Specified service name does not exist" + And I wait for "5" seconds + When I run ernest with "env destroy fakeaws destroyable --yes" + Then The output should not contain "Specified environment name does not exist" And I wait for "1" seconds - When I run ernest with "service destroy destroyable --yes" - Then The output should contain "Specified service name does not exist" + When I run ernest with "env destroy fakeaws destroyable --yes" + Then The output should contain "Specified environment name does not exist" diff --git a/internal/features/cli/service_history.feature b/internal/features/cli/service_history.feature index be0570e..e070d9a 100644 --- a/internal/features/cli/service_history.feature +++ b/internal/features/cli/service_history.feature @@ -1,31 +1,33 @@ -@service @service_history -Feature: Service history +@environment @environment_history +Feature: Environment history - Scenario: Non logged service history + Scenario: Non logged environment history Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service history" + When I run ernest with "env history" Then The output should contain "You're not allowed to perform this action, please log in" - When I run ernest with "service destroy destroyable" + When I run ernest with "env destroy fakeaws destroyable" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Logged service history unexisting + Scenario: Logged environment history unexisting Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - When I run ernest with "service history" - Then The output should contain "You should specify an existing service name" - When I run ernest with "service history unexisting" - Then The output should contain "There are no registered builds for this service" + When I run ernest with "env history" + Then The output should contain "You should specify an existing project name" + When I run ernest with "env history fakeaws" + Then The output should contain "You should specify an existing environment name" + When I run ernest with "env history fakeaws unexisting" + Then The output should contain "There are no registered builds for this environment" - Scenario: Logged service history + Scenario: Logged environment history Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "destroyable" does not exist + And The environment "destroyable" does not exist And I apply the definition "destroyable.yml" And I wait for "5" seconds And I apply the definition "destroyable2.yml" And I wait for "5" seconds - When I run ernest with "service history destroyable" + When I run ernest with "env history fakeaws destroyable" Then The output line number "3" should contain "destroyable" And The output line number "3" should contain "done" And The output line number "3" should contain "usr" diff --git a/internal/features/cli/service_import.feature b/internal/features/cli/service_import.feature index cda5345..efa21a7 100644 --- a/internal/features/cli/service_import.feature +++ b/internal/features/cli/service_import.feature @@ -1,27 +1,27 @@ -@service @service_import -Feature: Service import +@environment @environment_import +Feature: Environment import - Scenario: Non logged service import + Scenario: Non logged environment import Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service import" + When I run ernest with "environment import" Then The output should contain "You're not allowed to perform this action, please log in" - When I run ernest with "service import imported" + When I run ernest with "environment import imported" Then The output should contain "You're not allowed to perform this action, please log in" - Scenario: Logged service import errors + Scenario: Logged environment import errors Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - When I run ernest with "service import" - Then The output should contain "You should specify an existing datacenter name" - When I run ernest with "service import unexisting" - Then The output should contain "You should specify a valid service name" + When I run ernest with "environment import" + Then The output should contain "You should specify an existing project name" + When I run ernest with "environment import unexisting" + Then The output should contain "You should specify a valid environment name" - Scenario: Logged service non existing import + Scenario: Logged environment non existing import Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "imported" does not exist - When I run ernest with "service import fakeaws imported" + And The environment "imported" does not exist + When I run ernest with "environment import fakeaws imported" Then The output should contain regex "Ebs Volumes\s*2/2\s*Found" And The output should contain regex "Elbs\s*1/1\s*Found" And The output should contain regex "Firewalls\s*2/2\s*Found" diff --git a/internal/features/cli/service_info.feature b/internal/features/cli/service_info.feature index 233cb8b..c5c9979 100644 --- a/internal/features/cli/service_info.feature +++ b/internal/features/cli/service_info.feature @@ -1,18 +1,18 @@ -@service @service_info -Feature: Ernest service info +@environment @environment_info +Feature: Ernest environment info Scenario: Non logged user info Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service info" + When I run ernest with "environment info" Then The output should contain "You're not allowed to perform this action, please log in" Scenario: Logged user info Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "destroyable" does not exist + And The environment "destroyable" does not exist And I apply the definition "destroyable.yml" - When I run ernest with "service info destroyable" + When I run ernest with "environment info fakeaws destroyable" Then The output should contain "Name : destroyable" And The output should contain "VPCs:" And The output should contain "| test-vpc | fakeaws |" diff --git a/internal/features/cli/service_list.feature b/internal/features/cli/service_list.feature index bb1203f..7482918 100644 --- a/internal/features/cli/service_list.feature +++ b/internal/features/cli/service_list.feature @@ -1,18 +1,18 @@ -@service @service_list -Feature: Ernest service list +@environment @environment_list +Feature: Ernest environment list Scenario: Non logged user listing Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service list" + When I run ernest with "environment list" Then The output should contain "You're not allowed to perform this action, please log in" Scenario: Logged user listing Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "destroyable" does not exist + And The environment "destroyable" does not exist And I apply the definition "destroyable.yml" - When I run ernest with "service list" + When I run ernest with "environment list" Then The output should contain "destroyable" And The output should not contain "errored" And The output should contain "usr" diff --git a/internal/features/cli/service_reset.feature b/internal/features/cli/service_reset.feature index f07f3a4..44b17b7 100644 --- a/internal/features/cli/service_reset.feature +++ b/internal/features/cli/service_reset.feature @@ -1,29 +1,30 @@ -@service @service_reset -Feature: Ernest service reset +@environment @environment_reset +Feature: Ernest environment reset Scenario: Non logged user reset Given I setup ernest with target "https://ernest.local" And I logout - When I run ernest with "service reset" + When I run ernest with "environment reset" Then The output should contain "You're not allowed to perform this action, please log in" Scenario: Logged user reset Given I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" - And The service "destroyable" does not exist + And The environment "fakeaws/destroyable" does not exist And I apply the definition "destroyable.yml" - When I run ernest with "service reset destroyable" - Then The output should contain "The service 'destroyable' cannot be reset as its status is 'done'" - And I force "destroyable" to be on status "in_progress" - When I run ernest with "service list" + And I wait for "2" seconds + When I run ernest with "env reset fakeaws destroyable" + Then The output should contain "The environment 'fakeaws / destroyable' cannot be reset as its status is 'done'" + And I force "fakeaws/destroyable" to be on status "in_progress" + When I run ernest with "env list" And The output line number "3" should contain "destroyable" And The output line number "3" should contain "in_progress" And The output line number "3" should contain "usr" - When I run ernest with "service reset destroyable" - Then The output should contain "You've successfully resetted the service 'destroyable'" - When I run ernest with "service list" + When I run ernest with "env reset fakeaws destroyable" + Then The output should contain "You've successfully resetted the environment 'fakeaws / destroyable'" + When I run ernest with "environment list" And The output line number "3" should contain "destroyable" And The output line number "3" should contain "errored" And The output line number "3" should contain "usr" - When I run ernest with "service reset destroyable" - Then The output should contain "The service 'destroyable' cannot be reset as its status is 'errored'" + When I run ernest with "environment reset fakeaws destroyable" + Then The output should contain "The environment 'fakeaws / destroyable' cannot be reset as its status is 'errored'" diff --git a/internal/features/cli/service_revert.feature b/internal/features/cli/service_revert.feature index cce8abc..2dd2c3a 100644 --- a/internal/features/cli/service_revert.feature +++ b/internal/features/cli/service_revert.feature @@ -1,31 +1,31 @@ -@service @service_revert -Feature: Service revert +@environment @environment_revert +Feature: Environment revert Background: Given I setup ernest with target "https://ernest.local" - Scenario: User reverts a service + Scenario: User reverts a environment Given I'm logged in as "usr" / "secret123" And I apply the definition "service-revert.yml" And I apply the definition "service-revert2.yml" - And I run ernest with "service revert myService 1" - When I run ernest with "service definition myService" + And I run ernest with "env revert fakeaws myService 1" + When I run ernest with "env definition fakeaws myService" Then The output should contain "net-1" And The output should not contain "net-2" - Scenario: User reverts a service wihout providing a service name or build ID + Scenario: User reverts a environment wihout providing a environment name or build ID Given I'm logged in as "usr" / "secret123" And I apply the definition "service-revert.yml" - When I run ernest with "service revert myService" - Then The output should contain "Please specify a service name and build ID" + When I run ernest with "env revert myService" + Then The output should contain "Please specify a project, environment and build ID" - Scenario: User reverts a service providing an invalid build ID + Scenario: User reverts a environment providing an invalid build ID Given I'm logged in as "usr" / "secret123" And I apply the definition "service-revert.yml" - When I run ernest with "service revert myService 99" + When I run ernest with "env revert fakeaws myService 99" Then The output should contain "Invalid build ID" - Scenario: Unauthenticated user reverts a service + Scenario: Unauthenticated user reverts a environment Given I logout - When I run ernest with "service revert" + When I run ernest with "env revert" Then The output should contain "You're not allowed to perform this action, please log in" diff --git a/internal/features/cli/usage_report.feature b/internal/features/cli/usage_report.feature index 04e7ec9..ed3e0d0 100644 --- a/internal/features/cli/usage_report.feature +++ b/internal/features/cli/usage_report.feature @@ -1,8 +1,8 @@ -@service @usage_report +@environment @usage_report Feature: Usage report Scenario: Usage report - Given I setup a new service name + Given I setup a new environment name And I setup ernest with target "https://ernest.local" And I'm logged in as "usr" / "secret123" And I apply the definition "aws1.yml" diff --git a/internal/features/cli/user_disable.feature b/internal/features/cli/user_disable.feature index 508e66b..701cb5f 100644 --- a/internal/features/cli/user_disable.feature +++ b/internal/features/cli/user_disable.feature @@ -24,7 +24,6 @@ Feature: Ernest user disable And I'm logged in as "ci_admin" / "secret123" And The output should contain "Welcome back ci_admin" When I run ernest with "user create to_disable secret123" - And I run ernest with "group-add to_disable test" And I'm logged in as "to_disable" / "secret123" Then The output should contain "Welcome back to_disable" When I'm logged in as "ci_admin" / "secret123" @@ -32,5 +31,4 @@ Feature: Ernest user disable And I run ernest with "user disable to_disable" And The output should contain "Account `to_disable` has been disabled" And I'm logged in as "to_disable" / "secret123" - Then The output should contain "The keypair user / password does not match any user on the database, please try again" - + Then The output should contain "Authentication failed" diff --git a/internal/features/cli/users_to_groups.feature b/internal/features/cli/users_to_groups.feature deleted file mode 100644 index dc373da..0000000 --- a/internal/features/cli/users_to_groups.feature +++ /dev/null @@ -1,76 +0,0 @@ -@group @users_to_groups -Feature: Ernest users to groups - - Scenario: Non logged - user to group - Given I setup ernest with target "https://ernest.local" - And I logout - When I run ernest with "group add-user" - Then The output should contain "You should specify the username and group name" - When I run ernest with "group add-user tmp_user" - Then The output should contain "You should specify the group name" - When I run ernest with "group add-user tmp_user tmp_group" - Then The output should contain "You're not allowed to perform this action, please log in" - - Scenario: Plain user - user to group - Given I setup ernest with target "https://ernest.local" - And I'm logged in as "usr" / "secret123" - When I run ernest with "group add-user" - Then The output should contain "You should specify the username and group name" - When I run ernest with "group add-user tmp_user" - Then The output should contain "You should specify the group name" - When I run ernest with "group add-user tmp_user tmp_group" - Then The output should contain "You don't have permissions to perform this action" - - Scenario: Admin user - user to group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" exists - And the user "tmp_user" exists - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group add-user" - Then The output should contain "You should specify the username and group name" - When I run ernest with "group add-user tmp_user" - Then The output should contain "You should specify the group name" - When I run ernest with "group add-user tmp_user tmp_group" - Then The output should contain "User 'tmp_user' is now assigned to group 'tmp_group'" - When I run ernest with "user list" - Then The output users table should contain "tmp_user" assigned to "tmp_group" group - - Scenario: Already assigned user - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" exists - And the user "tmp_user" exists - And I'm logged in as "ci_admin" / "secret123" - And I run ernest with "group add-user tmp_user tmp_group" - When I run ernest with "group add-user tmp_user tmp_group" - Then The output should contain "User 'tmp_user' already belongs to 'tmp_group' group" - - Scenario: Unexisting group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" does not exist - And the user "tmp_user" exists - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group add-user tmp_user tmp_group" - Then The output should contain "Group 'tmp_group' does not exist" - - Scenario: Unexisting user - Given I setup ernest with target "https://ernest.local" - And the user "tmp_user" does not exist - And the group "tmp_group" exists - And I'm logged in as "ci_admin" / "secret123" - When I run ernest with "group add-user tmp_user tmp_group" - Then The output should contain "User 'tmp_user' does not exist" - - Scenario: Admin user - remove user from group - Given I setup ernest with target "https://ernest.local" - And the group "tmp_group" exists - And the user "tmp_user" exists - And I'm logged in as "ci_admin" / "secret123" - And I run ernest with "group add-user tmp_user tmp_group" - When I run ernest with "group remove-user" - Then The output should contain "You should specify the username and group name" - When I run ernest with "group remove-user tmp_user" - Then The output should contain "You should specify the group name" - When I run ernest with "group remove-user tmp_user tmp_group" - Then The output should contain "User 'tmp_user' is not assigned anymore to group 'tmp_group'" - When I run ernest with "user list" - Then The output users table should contain "tmp_user" assigned to " " group diff --git a/internal/features/steps/step_definitions.go b/internal/features/steps/step_definitions.go index 1eb6054..2723434 100644 --- a/internal/features/steps/step_definitions.go +++ b/internal/features/steps/step_definitions.go @@ -40,10 +40,14 @@ func init() { cfg = ecc.NewConfig(os.Getenv("NATS_URI")) n = cfg.Nats() - Given("^I setup a new service name$", func() { + Given("^I setup a new environment name$", func() { serviceName = "aws" + strconv.Itoa(rand.Intn(9999999)) }) + Given(`^I setup a new environment name "(.+?)"$`, func(name string) { + serviceName = name + }) + Given(`^I setup ernest with target "(.+?)"$`, func(target string) { if os.Getenv("CURRENT_INSTANCE") != "" { target = os.Getenv("CURRENT_INSTANCE") @@ -65,7 +69,9 @@ func init() { }) When(`^I run ernest with "(.+?)"$`, func(args string) { + args = strings.Replace(args, "$(name)", serviceName, -1) cmdArgs := strings.Split(args, " ") + ernest(cmdArgs...) }) @@ -94,6 +100,13 @@ func init() { } }) + And(`^The output should contain regex "(.*)"$`, func(needle string) { + r := regexp.MustCompile(needle) + if r.MatchString(lastOutput) == false { + T.Errorf(`Last output string does not contain regex "` + needle + `": ` + "\n" + lastOutput) + } + }) + Then(`^The output should not contain regex "(.*)"$`, func(needle string) { r := regexp.MustCompile(needle) if r.MatchString(lastOutput) == true { @@ -101,6 +114,13 @@ func init() { } }) + And(`^The output should not contain regex "(.*)"$`, func(needle string) { + r := regexp.MustCompile(needle) + if r.MatchString(lastOutput) == true { + T.Errorf(`Last output string does contain regex "` + needle + `" but it shouldn't: ` + "\n" + lastOutput) + } + }) + When(`^I logout$`, func() { ernest("logout") }) @@ -112,33 +132,21 @@ func init() { lastError = err }) - And(`^The group "(.+?)" does not exist$`, func(group string) { - msg := []byte(`{"name":"` + group + `"}`) - _, _ = n.Request("group.del", msg, time.Second*3) - }) - And(`^The user "(.+?)" does not exist$`, func(user string) { msg := []byte(`{"username":"` + user + `"}`) _, _ = n.Request("user.del", msg, time.Second*3) }) - And(`^The datacenter "(.+?)" does not exist$`, func(d string) { + And(`^The project "(.+?)" does not exist$`, func(d string) { msg := []byte(`{"name":"` + d + `", "type":"aws"}`) _, _ = n.Request("datacenter.del", msg, time.Second*3) }) - And(`^The service "(.+?)" does not exist$`, func(d string) { + And(`^The environment "(.+?)" does not exist$`, func(d string) { msg := []byte(`{"name":"` + d + `", "type":"aws"}`) _, _ = n.Request("service.del", msg, time.Second*3) }) - And(`^The group "(.+?)" exists$`, func(group string) { - msg := []byte(`{"name":"` + group + `"}`) - _, _ = n.Request("group.del", msg, time.Second*3) - msg = []byte(`{"name":"` + group + `"}`) - _, _ = n.Request("group.set", msg, time.Second*3) - }) - And(`^The user "(.+?)" exists$`, func(user string) { msg := []byte(`{"username":"` + user + `"}`) _, _ = n.Request("user.del", msg, time.Second*3) @@ -146,7 +154,7 @@ func init() { _, _ = n.Request("user.set", msg, time.Second*3) }) - And(`^The datacenter "(.+?)" exists$`, func(d string) { + And(`^The project "(.+?)" exists$`, func(d string) { msg := []byte(`{"name":"` + d + `", "type":"aws"}`) _, _ = n.Request("datacenter.del", msg, time.Second*3) msg = []byte(`{"name":"` + d + `"}`) @@ -157,28 +165,6 @@ func init() { time.Sleep(time.Duration(n) * time.Second) }) - Then(`^The output users table should contain "(.+?)" assigned to "(.+?)" group$`, func(user string, group string) { - lines := strings.Split(lastOutput, "\n") - for _, l := range lines { - if strings.Contains(l, user) { - if !strings.Contains(l, "| "+group) { - T.Errorf(`User doesn't seem to belong to specified group: \n` + l) - } - } - } - }) - - Then(`^The output datacenters table should contain "(.+?)" assigned to "(.+?)" group$`, func(datacenter string, group string) { - lines := strings.Split(lastOutput, "\n") - for _, l := range lines { - if strings.Contains(l, datacenter) { - if !strings.Contains(l, "| "+group) { - T.Errorf(`Datacenter doesn't seem to belong to specified group: \n` + l) - } - } - } - }) - Then(`^The output line number "(.+?)" should contain "(.+?)"$`, func(number int, needle string) { lines := strings.Split(lastOutput, "\n") n := strconv.Itoa(number) @@ -194,8 +180,8 @@ func init() { }) - And(`^I force "(.+?)" to be on status "(.+?)"$`, func(service string, status string) { - _, _ = n.Request("service.set", []byte(`{"name":"`+service+`","status":"`+status+`"}`), time.Second*3) + And(`^I force "(.+?)" to be on status "(.+?)"$`, func(environment string, status string) { + _, _ = n.Request("build.set.status", []byte(`{"name":"`+environment+`","status":"`+status+`"}`), time.Second*3) }) And(`^File "(.+?)" exists$`, func(filename string) { @@ -214,8 +200,8 @@ func init() { }) And(`^I stop recording$`, func() { - _ = sub.Unsubscribe() time.Sleep(time.Second * 5) + _ = sub.Unsubscribe() }) Then(`^all "(.+?)" messages should contain a field "(.+?)" with "(.+?)"$`, func(subject string, field string, val string) { @@ -271,7 +257,7 @@ func init() { } } def = getDefinitionPathAWS(def, serviceName) - ernest("service", "apply", def) + ernest("environment", "apply", def) }) And(`^I apply the definition "(.+?)" with dry option$`, func(def string) { @@ -282,7 +268,20 @@ func init() { } } def = getDefinitionPathAWS(def, serviceName) - ernest("service", "apply", "--dry", def) + ernest("environment", "apply", "--dry", def) + }) + + And(`^I apply "(.+?)" with "(.+?)"$`, func(def string, opts string) { + if delay := os.Getenv("ERNEST_APPLY_DELAY"); delay != "" { + if t, err := strconv.Atoi(delay); err == nil { + println("\nWaiting " + delay + " seconds...") + time.Sleep(time.Duration(t) * time.Second) + } + } + def = getDefinitionPathAWS(def, serviceName) + options := []string{"environment", "apply", def} + options = append(options, strings.Split(opts, " ")...) + ernest(options...) }) And(`^message "(.+?)" number "(.+?)" should contain "(.+?)" as json field "(.+?)"$`, func(subject string, num int, val, key string) { @@ -329,33 +328,21 @@ func init() { lastError = err }) - And(`^the group "(.+?)" does not exist$`, func(group string) { - msg := []byte(`{"name":"` + group + `"}`) - _, _ = n.Request("group.del", msg, time.Second*3) - }) - And(`^the user "(.+?)" does not exist$`, func(user string) { msg := []byte(`{"username":"` + user + `"}`) _, _ = n.Request("user.del", msg, time.Second*3) }) - And(`^the datacenter "(.+?)" does not exist$`, func(d string) { + And(`^the project "(.+?)" does not exist$`, func(d string) { msg := []byte(`{"name":"` + d + `", "type":"aws"}`) _, _ = n.Request("datacenter.del", msg, time.Second*3) }) - And(`^The service "(.+?)" does not exist$`, func(d string) { + And(`^The environment "(.+?)" does not exist$`, func(d string) { msg := []byte(`{"name":"` + d + `", "type":"aws"}`) _, _ = n.Request("service.del", msg, time.Second*3) }) - And(`^the group "(.+?)" exists$`, func(group string) { - msg := []byte(`{"name":"` + group + `"}`) - _, _ = n.Request("group.del", msg, time.Second*3) - msg = []byte(`{"name":"` + group + `"}`) - _, _ = n.Request("group.set", msg, time.Second*3) - }) - And(`^the user "(.+?)" exists$`, func(user string) { msg := []byte(`{"username":"` + user + `"}`) _, _ = n.Request("user.del", msg, time.Second*3) @@ -363,7 +350,7 @@ func init() { _, _ = n.Request("user.set", msg, time.Second*3) }) - And(`^the datacenter "(.+?)" exists$`, func(d string) { + And(`^the project "(.+?)" exists$`, func(d string) { msg := []byte(`{"name":"` + d + `", "type":"aws"}`) _, _ = n.Request("datacenter.del", msg, time.Second*3) msg = []byte(`{"name":"` + d + `"}`) @@ -405,37 +392,39 @@ func init() { } }) - And(`^The azure datacenter "(.+?)" credentials should be "(.+?)", "(.+?)", "(.+?)", "(.+?)" and "(.+?)"$`, func(name, sID, cID, cSecret, tID, env string) { + And(`^The azure project "(.+?)" credentials should be "(.+?)", "(.+?)", "(.+?)", "(.+?)" and "(.+?)"$`, func(name, sID, cID, cSecret, tID, env string) { msg := []byte(`{"name":"` + name + `", "type":"azure"}`) res, _ := n.Request("datacenter.get", msg, time.Second*3) var d struct { - SubscriptionID string `json:"azure_subscription_id"` - ClientID string `json:"azure_client_id"` - ClientSecret string `json:"azure_client_secret"` - TenantID string `json:"azure_tenant_id"` - Environment string `json:"azure_environment"` + Credentials struct { + SubscriptionID string `json:"azure_subscription_id"` + ClientID string `json:"azure_client_id"` + ClientSecret string `json:"azure_client_secret"` + TenantID string `json:"azure_tenant_id"` + Environment string `json:"azure_environment"` + } `json:"credentials"` } key := os.Getenv("ERNEST_CRYPTO_KEY") _ = json.Unmarshal(res.Data, &d) crypto := aes.New() - subscriptionID, err := crypto.Decrypt(d.SubscriptionID, key) + subscriptionID, err := crypto.Decrypt(d.Credentials.SubscriptionID, key) if err != nil { log.Println(err) } - clientID, err := crypto.Decrypt(d.ClientID, key) + clientID, err := crypto.Decrypt(d.Credentials.ClientID, key) if err != nil { log.Println(err) } - clientSecret, err := crypto.Decrypt(d.ClientSecret, key) + clientSecret, err := crypto.Decrypt(d.Credentials.ClientSecret, key) if err != nil { log.Println(err) } - tenantID, err := crypto.Decrypt(d.TenantID, key) + tenantID, err := crypto.Decrypt(d.Credentials.TenantID, key) if err != nil { log.Println(err) } - environment, err := crypto.Decrypt(d.Environment, key) + environment, err := crypto.Decrypt(d.Credentials.Environment, key) if err != nil { log.Println(err) } @@ -457,22 +446,24 @@ func init() { } }) - And(`^The aws datacenter "(.+?)" credentials should be "(.+?)" and "(.+?)"$`, func(name, token, secret string) { + And(`^The aws project "(.+?)" credentials should be "(.+?)" and "(.+?)"$`, func(name, token, secret string) { msg := []byte(`{"name":"` + name + `", "type":"aws"}`) res, _ := n.Request("datacenter.get", msg, time.Second*3) var d struct { - Token string `json:"aws_access_key_id"` - Secret string `json:"aws_secret_access_key"` + Credentials struct { + Token string `json:"aws_access_key_id"` + Secret string `json:"aws_secret_access_key"` + } `json:"credentials"` } key := os.Getenv("ERNEST_CRYPTO_KEY") _ = json.Unmarshal(res.Data, &d) crypto := aes.New() - tk, err := crypto.Decrypt(d.Token, key) + tk, err := crypto.Decrypt(d.Credentials.Token, key) if err != nil { log.Println(err) } - se, err := crypto.Decrypt(d.Secret, key) + se, err := crypto.Decrypt(d.Credentials.Secret, key) if err != nil { log.Println(err) } @@ -489,28 +480,6 @@ func init() { time.Sleep(time.Duration(n) * time.Millisecond) }) - Then(`^The output users table should contain "(.+?)" assigned to "(.+?)" group$`, func(user string, group string) { - lines := strings.Split(lastOutput, "\n") - for _, l := range lines { - if strings.Contains(l, user) { - if !strings.Contains(l, "| "+group) { - T.Errorf(`User doesn't seem to belong to specified group: \n` + l) - } - } - } - }) - - Then(`^The output datacenters table should contain "(.+?)" assigned to "(.+?)" group$`, func(datacenter string, group string) { - lines := strings.Split(lastOutput, "\n") - for _, l := range lines { - if strings.Contains(l, datacenter) { - if !strings.Contains(l, "| "+group) { - T.Errorf(`Datacenter doesn't seem to belong to specified group: \n` + l) - } - } - } - }) - Then(`^The output line number "(.+?)" should contain "(.+?)"$`, func(number int, needle string) { lines := strings.Split(lastOutput, "\n") n := strconv.Itoa(number) @@ -526,8 +495,8 @@ func init() { }) - And(`^I force "(.+?)" to be on status "(.+?)"$`, func(service string, status string) { - _, _ = n.Request("service.set", []byte(`{"name":"`+service+`","status":"`+status+`"}`), time.Second*3) + And(`^I force "(.+?)" to be on status "(.+?)"$`, func(environment string, status string) { + _, _ = n.Request("build.set.status", []byte(`{"name":"`+environment+`","status":"`+status+`"}`), time.Second*3) }) And(`^File "(.+?)" exists$`, func(filename string) { @@ -561,8 +530,8 @@ func getDefinitionPathAWS(def string, service string) string { for _, line := range lines { if strings.Contains(line, "name: my_service") { finalLines = append(finalLines, "name: "+service) - } else if strings.Contains(line, "datacenter: r3-dc2") { - finalLines = append(finalLines, "datacenter: fakeaws") + } else if strings.Contains(line, "project: r3-dc2") { + finalLines = append(finalLines, "project: fakeaws") } else { finalLines = append(finalLines, line) } diff --git a/internal/features/vcloud/add_and_attach_network.feature b/internal/features/vcloud/add_and_attach_network.feature index 6327d7e..aa7123a 100644 --- a/internal/features/vcloud/add_and_attach_network.feature +++ b/internal/features/vcloud/add_and_attach_network.feature @@ -1,9 +1,9 @@ @vcloud @add_and_attach_network -Feature: Service apply +Feature: Environment apply Scenario: Add a network and attach a new instance Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "vcloud2.yml" And I start recording @@ -12,8 +12,8 @@ Feature: Service apply Then an event "network.create.vcloud-fake" should be called exactly "1" times And all "network.create.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" And all "network.create.vcloud-fake" messages should contain a field "range" with "10.1.0.0/24" - And all "network.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "network.create.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "network.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "network.create.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "network.create.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" Then an event "instance.create.vcloud-fake" should be called exactly "1" times diff --git a/internal/features/vcloud/base.feature b/internal/features/vcloud/base.feature index 89b7e04..99a2f56 100644 --- a/internal/features/vcloud/base.feature +++ b/internal/features/vcloud/base.feature @@ -1,9 +1,9 @@ @vcloud @vcloud_base -Feature: Service apply +Feature: Environment apply - Scenario: Applying a basic service + Scenario: Applying a basic environment Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I start recording And I apply the definition "vcloud1.yml" @@ -11,8 +11,8 @@ Feature: Service apply Then an event "router.create.vcloud-fake" should be called exactly "1" times And all "router.create.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" And all "router.create.vcloud-fake" messages should contain a field "name" with "vse2" - And all "router.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "router.create.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "router.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "router.create.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "router.create.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And message "router.create.vcloud-fake" number "0" should contain "in_in_any" as json field "firewall_rules.0.name" diff --git a/internal/features/vcloud/decrease_instances_count.feature b/internal/features/vcloud/decrease_instances_count.feature index 139a7f9..d2320d1 100644 --- a/internal/features/vcloud/decrease_instances_count.feature +++ b/internal/features/vcloud/decrease_instances_count.feature @@ -1,9 +1,9 @@ @vcloud @decrease_instances_count -Feature: Service apply +Feature: Environment apply Scenario: Decreasing instance count Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "vcloud4.yml" And I start recording @@ -11,8 +11,8 @@ Feature: Service apply And I stop recording Then an event "instance.delete.vcloud-fake" should be called exactly "1" times And all "instance.delete.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" - And all "instance.delete.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.delete.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "instance.delete.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.delete.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "instance.delete.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And all "instance.delete.vcloud-fake" messages should contain a field "name" with "web-2" diff --git a/internal/features/vcloud/increase_instances_count.feature b/internal/features/vcloud/increase_instances_count.feature index 5380e97..8084578 100644 --- a/internal/features/vcloud/increase_instances_count.feature +++ b/internal/features/vcloud/increase_instances_count.feature @@ -1,9 +1,9 @@ @vcloud @increase_instances_count -Feature: Service apply +Feature: Environment apply Scenario: Increasing instance count Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "vcloud3.yml" And I start recording @@ -11,8 +11,8 @@ Feature: Service apply And I stop recording Then an event "instance.create.vcloud-fake" should be called exactly "1" times And all "instance.create.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" - And all "instance.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.create.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "instance.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.create.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "instance.create.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And all "instance.create.vcloud-fake" messages should contain a field "name" with "web-2" diff --git a/internal/features/vcloud/instance_only.feature b/internal/features/vcloud/instance_only.feature index 4f118c3..cf11fda 100644 --- a/internal/features/vcloud/instance_only.feature +++ b/internal/features/vcloud/instance_only.feature @@ -1,17 +1,17 @@ @vcloud @instance_only -Feature: Service apply +Feature: Environment apply - Scenario: Applying an instance only service + Scenario: Applying an instance only environment Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I start recording And I apply the definition "vcloud8.yml" And I stop recording Then an event "instance.create.vcloud-fake" should be called exactly "1" times And all "instance.create.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" - And all "instance.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.create.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "instance.create.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.create.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "instance.create.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And all "instance.create.vcloud-fake" messages should contain a field "name" with "web-1" diff --git a/internal/features/vcloud/remove_and_dettach_network.feature b/internal/features/vcloud/remove_and_dettach_network.feature index c3e8cdf..bdd34c9 100644 --- a/internal/features/vcloud/remove_and_dettach_network.feature +++ b/internal/features/vcloud/remove_and_dettach_network.feature @@ -1,9 +1,9 @@ @vcloud @remove_and_dettach_network -Feature: Service apply +Feature: Environment apply Scenario: Remove a network and dettach an existing instance Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "vcloud3.yml" And I start recording @@ -11,8 +11,8 @@ Feature: Service apply And I stop recording Then an event "instance.delete.vcloud-fake" should be called exactly "1" times And all "instance.delete.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" - And all "instance.delete.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.delete.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "instance.delete.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.delete.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "instance.delete.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And all "instance.delete.vcloud-fake" messages should contain a field "name" with "web-1" @@ -26,7 +26,7 @@ Feature: Service apply Then an event "network.delete.vcloud-fake" should be called exactly "1" times And all "network.delete.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" And all "network.delete.vcloud-fake" messages should contain a field "range" with "10.1.0.0/24" - And all "network.delete.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "network.delete.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "network.delete.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "network.delete.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "network.delete.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" diff --git a/internal/features/vcloud/update_firewall_rules.feature b/internal/features/vcloud/update_firewall_rules.feature index 823e152..998791b 100644 --- a/internal/features/vcloud/update_firewall_rules.feature +++ b/internal/features/vcloud/update_firewall_rules.feature @@ -1,9 +1,9 @@ @vcloud @update_firewall_rules -Feature: Service apply +Feature: Environment apply Scenario: Updating router firewall rules Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "vcloud5.yml" And I start recording @@ -12,8 +12,8 @@ Feature: Service apply Then an event "router.update.vcloud-fake" should be called exactly "1" times And all "router.update.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" And all "router.update.vcloud-fake" messages should contain a field "name" with "vse2" - And all "router.update.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "router.update.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "router.update.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "router.update.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "router.update.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And message "router.update.vcloud-fake" number "0" should contain "in_in_any" as json field "firewall_rules.0.name" diff --git a/internal/features/vcloud/update_instances_resource.feature b/internal/features/vcloud/update_instances_resource.feature index df72fc1..ee388e0 100644 --- a/internal/features/vcloud/update_instances_resource.feature +++ b/internal/features/vcloud/update_instances_resource.feature @@ -1,9 +1,9 @@ @vcloud @update_instances_resource -Feature: Service apply +Feature: Environment apply Scenario: Update existing instance ram and cpu Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "vcloud4.yml" And I start recording @@ -11,8 +11,8 @@ Feature: Service apply And I stop recording Then an event "instance.update.vcloud-fake" should be called exactly "2" times And all "instance.update.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" - And all "instance.update.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.update.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "instance.update.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "instance.update.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "instance.update.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And message "instance.update.vcloud-fake" number "0" should contain "web-1" as json field "name" diff --git a/internal/features/vcloud/update_nat_rules.feature b/internal/features/vcloud/update_nat_rules.feature index bc42c42..a5eb305 100644 --- a/internal/features/vcloud/update_nat_rules.feature +++ b/internal/features/vcloud/update_nat_rules.feature @@ -1,9 +1,9 @@ @vcloud @update_nat_rules -Feature: Service apply +Feature: Environment apply Scenario: Updating router nat rules Given I setup ernest with target "https://ernest.local" - And I setup a new service name + And I setup a new environment name When I'm logged in as "usr" / "secret123" And I apply the definition "vcloud5.yml" And I start recording @@ -12,8 +12,8 @@ Feature: Service apply Then an event "router.update.vcloud-fake" should be called exactly "1" times And all "router.update.vcloud-fake" messages should contain a field "_provider" with "vcloud-fake" And all "router.update.vcloud-fake" messages should contain a field "name" with "vse2" - And all "router.update.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "router.update.vcloud-fake" messages should contain a field "datacenter_name" with "fakevcloud" + And all "router.update.vcloud-fake" messages should contain a field "vcloud_url" with "https://vcloud.net" And all "router.update.vcloud-fake" messages should contain an encrypted field "datacenter_username" with "fakeuser@test" And all "router.update.vcloud-fake" messages should contain an encrypted field "datacenter_password" with "test123" And message "router.update.vcloud-fake" number "0" should contain "dnat" as json field "nat_rules.0.type" diff --git a/internal/template.yml b/internal/template.yml index e31b130..ce3cbeb 100644 --- a/internal/template.yml +++ b/internal/template.yml @@ -1,8 +1,6 @@ --- version: '2' services: - redis: - image: redis nats: image: nats ports: diff --git a/premium.yml b/premium.yml index a6aa06e..46ae864 100644 --- a/premium.yml +++ b/premium.yml @@ -4,7 +4,7 @@ branch: master links: - nats - depends: + depends_on: - config-store environment: NATS_URI: 'nats://nats:4222' diff --git a/setup b/setup index 83fafcc..433b76b 100755 --- a/setup +++ b/setup @@ -105,8 +105,7 @@ done # setup admin accounts -./natsc request -s nats://127.0.0.1:4222 -t 5 -r 99 'group.set' '{"id":"1","name": "admin"}' -./natsc request -s nats://127.0.0.1:4222 -t 5 -r 99 'user.set' "{\"group_id\": 1, \"username\": \"$USERNAME\", \"password\": \"$PASSWORD\", \"admin\":true}" +./natsc request -s nats://127.0.0.1:4222 -t 5 -r 99 'user.set' "{\"username\": \"$USERNAME\", \"password\": \"$PASSWORD\", \"admin\":true}" echo echo "Setup complete!" diff --git a/template.yml b/template.yml index 3dca9e2..c6277c3 100644 --- a/template.yml +++ b/template.yml @@ -10,7 +10,7 @@ services: volumes: - ./postgres/data:/var/lib/postgresql/data environment: - DB_NAME: users,groups,datacenters,services,usage + DB_NAME: users,projects,environments,usage,authorizations nginx: image: nginx volumes: