Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Notify uchiwa service when package changes #34

Merged
merged 1 commit into from
Mar 14, 2015

Conversation

timmow
Copy link
Member

@timmow timmow commented Mar 5, 2015

By default the package is set to ensure latest - we were running with this,
which caused our preview environment to update. We fixed to the version running
in production - alphagov/pp-puppet#735 but although the
package was downgraded, the service did not restart, hence adding the notify.
We had to downgrade because we hit a bug similar to
sensu/uchiwa#272

@timmow
Copy link
Member Author

timmow commented Mar 5, 2015

I ran the rake tests, but the beaker tests failed to run - I suspect because I am using vmware fusion rather than virtualbox

@ajlanghorn
Copy link

@timmow I've just run them using VirtualBox, and I get:

  1) sensu class uchiwa ensure => present should start uchiwa
     On host ``
     Failure/Error: expect(curl.stdout).to include '<html lang="en" ng-app="uchiwa" ng-controller="init">'

       expected "<!DOCTYPE html>\n<html lang=\"en\" ng-app=\"uchiwa\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <meta name=\"description\" content=\"\">\n  <meta name=\"author\" content=\"\">\n\n  <link rel=\"icon\" type=\"image/png\" href=\"bower_components/uchiwa-web/img/favicon.png\">\n\n  <title ng-bind=\"titleFactory.get()\">uchiwa</title>\n\n  <!-- Customized Bootstrap -->\n  <link href=\"bower_components/uchiwa-web/css/bootstrap-uchiwa/bootstrap-uchiwa.css\" rel=\"stylesheet\">\n\n  <!-- 3rd Party CSS -->\n  <link href=\"bower_components/fontawesome/css/font-awesome.min.css\" rel=\"stylesheet\">\n  <link href=\"bower_components/angular-toastr/dist/angular-toastr.min.css\" rel=\"stylesheet\">\n  <link href=\"bower_components/highlightjs/styles/tomorrow.css\" rel=\"stylesheet\">\n  <link href=\"//fonts.googleapis.com/css?family=Roboto:300,400,700\" rel=\"stylesheet\" type=\"text/css\">\n\n  <!-- Uchiwa CSS -->\n  <link href=\"bower_components/uchiwa-web/css/uchiwa-default/uchiwa-default.css\" rel=\"stylesheet\" site-theme>\n</head>\n\n<body ng-cloak>\n\n<ng-view></ng-view>\n\n<!-- 3rd Party JS -->\n<script src=\"bower_components/angular/angular.min.js\"></script>\n<script src=\"bower_components/angular-cookies/angular-cookies.min.js\"></script>\n<script src=\"bower_components/angular-route/angular-route.min.js\"></script>\n<script src=\"bower_components/angular-sanitize/angular-sanitize.min.js\"></script>\n<script src=\"bower_components/async/lib/async.js\"></script>\n<script src=\"bower_components/underscore/underscore.js\"></script>\n<script src=\"bower_components/angular-toastr/dist/angular-toastr.min.js\"></script>\n<script src=\"bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js\"></script>\n<script src=\"bower_components/highlightjs/highlight.pack.js\"></script>\n<script src=\"bower_components/moment/moment.js\"></script>\n\n<!-- Uchiwa JS -->\n<script src=\"bower_components/uchiwa-web/js/app.js\"></script>\n<script src=\"bower_components/uchiwa-web/js/constants.js\"></script>\n<script src=\"bower_components/uchiwa-web/js/controllers.js\"></script>\n<script src=\"bower_components/uchiwa-web/js/directives.js\"></script>\n<script src=\"bower_components/uchiwa-web/js/factories.js\"></script>\n<script src=\"bower_components/uchiwa-web/js/filters.js\"></script>\n<script src=\"bower_components/uchiwa-web/js/providers.js\"></script>\n<script src=\"bower_components/uchiwa-web/js/services.js\"></script>\n</body>\n</html>\n" to include "<html lang=\"en\" ng-app=\"uchiwa\" ng-controller=\"init\">"
       Diff:
       @@ -1,2 +1,53 @@
       -<html lang="en" ng-app="uchiwa" ng-controller="init">
       +<!DOCTYPE html>
       +<html lang="en" ng-app="uchiwa">
       +<head>
       +  <meta charset="utf-8">
       +  <meta name="viewport" content="width=device-width, initial-scale=1.0">
       +  <meta name="description" content="">
       +  <meta name="author" content="">
       +
       +  <link rel="icon" type="image/png" href="bower_components/uchiwa-web/img/favicon.png">
       +
       +  <title ng-bind="titleFactory.get()">uchiwa</title>
       +
       +  <!-- Customized Bootstrap -->
       +  <link href="bower_components/uchiwa-web/css/bootstrap-uchiwa/bootstrap-uchiwa.css" rel="stylesheet">
       +
       +  <!-- 3rd Party CSS -->
       +  <link href="bower_components/fontawesome/css/font-awesome.min.css" rel="stylesheet">
       +  <link href="bower_components/angular-toastr/dist/angular-toastr.min.css" rel="stylesheet">
       +  <link href="bower_components/highlightjs/styles/tomorrow.css" rel="stylesheet">
       +  <link href="//fonts.googleapis.com/css?family=Roboto:300,400,700" rel="stylesheet" type="text/css">
       +
       +  <!-- Uchiwa CSS -->
       +  <link href="bower_components/uchiwa-web/css/uchiwa-default/uchiwa-default.css" rel="stylesheet" site-theme>
       +</head>
       +
       +<body ng-cloak>
       +
       +<ng-view></ng-view>
       +
       +<!-- 3rd Party JS -->
       +<script src="bower_components/angular/angular.min.js"></script>
       +<script src="bower_components/angular-cookies/angular-cookies.min.js"></script>
       +<script src="bower_components/angular-route/angular-route.min.js"></script>
       +<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
       +<script src="bower_components/async/lib/async.js"></script>
       +<script src="bower_components/underscore/underscore.js"></script>
       +<script src="bower_components/angular-toastr/dist/angular-toastr.min.js"></script>
       +<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
       +<script src="bower_components/highlightjs/highlight.pack.js"></script>
       +<script src="bower_components/moment/moment.js"></script>
       +
       +<!-- Uchiwa JS -->
       +<script src="bower_components/uchiwa-web/js/app.js"></script>
       +<script src="bower_components/uchiwa-web/js/constants.js"></script>
       +<script src="bower_components/uchiwa-web/js/controllers.js"></script>
       +<script src="bower_components/uchiwa-web/js/directives.js"></script>
       +<script src="bower_components/uchiwa-web/js/factories.js"></script>
       +<script src="bower_components/uchiwa-web/js/filters.js"></script>
       +<script src="bower_components/uchiwa-web/js/providers.js"></script>
       +<script src="bower_components/uchiwa-web/js/services.js"></script>
       +</body>
       +</html>

     # ./spec/acceptance/class_spec.rb:54:in `block (5 levels) in <top (required)>'
     # ./spec/acceptance/class_spec.rb:53:in `block (4 levels) in <top (required)>'

  2) sensu class uchiwa ensure => present should produce consistent uchiwa.json file
     On host ``
     Failure/Error: expect(cat.stdout).to eq (uchiwa_json)


       expected: "{\n\"sensu\": [\n    {\n      \"name\": \"Main Server\",\n      \"host\": \"127.0.0.1\",\n      \"ssl\": false,\n      \"insecure\": false,\n      \"port\": 4567,\n      \"user\": \"sensu\",\n      \"pass\": \"secret\",\n      \"path\": \"\",\n      \"timeout\": 5000\n    }\n  ],\n  \"uchiwa\": {\n    \"host\": \"0.0.0.0\",\n    \"port\": 3000,\n    \"user\": \"\",\n    \"pass\": \"\",\n    \"stats\": 10,\n    \"refresh\": 10000\n  }\n}\n"
            got: "{\n\"sensu\": [\n    {\n      \"name\": \"Main Server\",\n      \"host\": \"127.0.0.1\",\n      \"ssl\": false,\n      \"insecure\": false,\n      \"port\": 4567,\n      \"user\": \"sensu\",\n      \"pass\": \"secret\",\n      \"path\": \"\",\n      \"timeout\": 5000\n    }\n  ],\n  \"uchiwa\": {\n    \"host\": \"0.0.0.0\",\n    \"port\": 3000,\n    \"user\": \"\",\n    \"pass\": \"\",\n    \"refresh\": 5\n  }\n}\n"

       (compared using ==)

       Diff:
       @@ -17,8 +17,7 @@
            "port": 3000,
            "user": "",
            "pass": "",
       -    "stats": 10,
       -    "refresh": 10000
       +    "refresh": 5
          }
        }
     # ./spec/acceptance/class_spec.rb:62:in `block (5 levels) in <top (required)>'
     # ./spec/acceptance/class_spec.rb:61:in `block (4 levels) in <top (required)>'

  3) sensu class uchiwa ensure => present should produce a uchiwa.json file from defaults
     On host ``
     Failure/Error: expect(cat.stdout).to eq (uchiwa_json)


       expected: "{\n\"sensu\": [\n    {\n      \"name\": \"sensu\",\n      \"host\": \"127.0.0.1\",\n      \"ssl\": false,\n      \"insecure\": false,\n      \"port\": 4567,\n      \"user\": \"sensu\",\n      \"pass\": \"sensu\",\n      \"path\": \"\",\n      \"timeout\": 5000\n    }\n  ],\n  \"uchiwa\": {\n    \"host\": \"0.0.0.0\",\n    \"port\": 3000,\n    \"user\": \"\",\n    \"pass\": \"\",\n    \"stats\": 10,\n    \"refresh\": 10000\n  }\n}\n"
            got: "{\n\"sensu\": [\n    {\n      \"name\": \"sensu\",\n      \"host\": \"127.0.0.1\",\n      \"ssl\": false,\n      \"insecure\": false,\n      \"port\": 4567,\n      \"user\": \"sensu\",\n      \"pass\": \"sensu\",\n      \"path\": \"\",\n      \"timeout\": 5\n    }\n  ],\n  \"uchiwa\": {\n    \"host\": \"0.0.0.0\",\n    \"port\": 3000,\n    \"user\": \"\",\n    \"pass\": \"\",\n    \"refresh\": 5\n  }\n}\n"

       (compared using ==)

       Diff:
       @@ -9,7 +9,7 @@
              "user": "sensu",
              "pass": "sensu",
              "path": "",
       -      "timeout": 5000
       +      "timeout": 5
            }
          ],
          "uchiwa": {
       @@ -17,8 +17,7 @@
            "port": 3000,
            "user": "",
            "pass": "",
       -    "stats": 10,
       -    "refresh": 10000
       +    "refresh": 5
          }
        }
     # ./spec/acceptance/class_spec.rb:87:in `block (5 levels) in <top (required)>'
     # ./spec/acceptance/class_spec.rb:86:in `block (4 levels) in <top (required)>'

Finished in 2 minutes 51.4 seconds
8 examples, 3 failures

Failed examples:

rspec ./spec/acceptance/class_spec.rb:52 # sensu class uchiwa ensure => present should start uchiwa
rspec ./spec/acceptance/class_spec.rb:57 # sensu class uchiwa ensure => present should produce consistent uchiwa.json file
rspec ./spec/acceptance/class_spec.rb:82 # sensu class uchiwa ensure => present should produce a uchiwa.json file from defaults
/opt/boxen/rbenv/versions/1.9.3-p484/bin/ruby -S rspec spec/acceptance --color failed

@pauloconnor
Copy link
Contributor

Can you pull and merge master please? That should fix the tests. Thanks.

@timmow
Copy link
Member Author

timmow commented Mar 12, 2015

@pauloconnor rebased, tests now pass

pauloconnor added a commit that referenced this pull request Mar 14, 2015
Notify uchiwa service when package changes
@pauloconnor pauloconnor merged commit 481a22f into Yelp:master Mar 14, 2015
@pauloconnor
Copy link
Contributor

Nice one! Thanks for the PR.

@timmow timmow deleted the package-notify-service branch March 19, 2015 09:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants