diff --git a/.expeditor/automate_build.sh b/.expeditor/automate_build.sh index c16289f3f5..f5ac37625e 100755 --- a/.expeditor/automate_build.sh +++ b/.expeditor/automate_build.sh @@ -42,6 +42,7 @@ HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CA git clone https://github.com/chef/automate.git cd automate +git checkout ssudheer/cs_license_test RESOLVED_RESULTS_DIR=$(realpath results/) export DO_CHECK=true diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 482ff466e2..78a4d2382f 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -223,6 +223,9 @@ steps: A2_LICENSE: path: secret/a2/license field: license + A2_EXPIRED_LICENSE: + path: secret/a2/license + field: expLicense - label: "chef server only" command: @@ -236,6 +239,9 @@ steps: A2_LICENSE: path: secret/a2/license field: license + A2_EXPIRED_LICENSE: + path: secret/a2/license + field: expLicense - label: "ha chef server" command: @@ -249,4 +255,7 @@ steps: secrets: A2_LICENSE: path: secret/a2/license - field: license \ No newline at end of file + field: license + A2_EXPIRED_LICENSE: + path: secret/a2/license + field: expLicense \ No newline at end of file diff --git a/oc-chef-pedant/spec/api/server_license_spec.rb b/oc-chef-pedant/spec/api/server_license_spec.rb index cf6533e03b..aa79ec6328 100644 --- a/oc-chef-pedant/spec/api/server_license_spec.rb +++ b/oc-chef-pedant/spec/api/server_license_spec.rb @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- require 'pedant/rspec/common' -describe "server licence testing", :license do +describe "server license testing", :license do # Pedant has configurable test users. # Selects Pedant users that are marked as associated @@ -24,15 +24,15 @@ } end - context "when having valid licence" do - it "can get all users" do + context "when having valid license" do + it "can get all users", automate: true do get(request_url, platform.superuser).should look_like({ :status => 200, :body => users_body }) end - it "can get status" do + it "can get status", automate: true do get(status_url, platform.superuser).should look_like({ :status => 200 }) @@ -40,14 +40,23 @@ end # context "failure case", automate: true do - context "failure case" do - it "returns 403" do + context "when not having valid license" do + before(:all) do + system("chef-automate license apply \"$A2_EXPIRED_LICENSE\"") + system("sleep 30") + end + after(:all) do + system("chef-automate license apply \"$A2_LICENSE\"") + system("sleep 30") + end + + it "returns 403", automate: true do puts get(request_url, platform.superuser) get(request_url, platform.superuser).should look_like({ :status => 403 }) end - it "can get status" do + it "can get status", automate: true do get(status_url, platform.superuser).should look_like({ :status => 200 })