├── .gitignore ├── .kitchen.yml ├── .rubocop.yml ├── .travis.yml ├── Berksfile ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── Thorfile ├── attributes └── default.rb ├── chefignore ├── metadata.rb ├── recipes ├── default.rb ├── install.rb └── service.rb ├── templates └── default │ └── wrapper.erb └── test └── integration └── default └── serverspec └── default_spec.rb /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | *~ 4 | *# 5 | .#* 6 | \#*# 7 | .*.sw[a-z] 8 | *.un~ 9 | /cookbooks 10 | 11 | # Bundler 12 | Gemfile.lock 13 | bin/* 14 | .bundle/* 15 | 16 | .kitchen/ 17 | .kitchen.local.yml 18 | -------------------------------------------------------------------------------- /.kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | customize: {cpus: 2, memory: 1024} 5 | network: 6 | - ["forwarded_port", {guest: 8080, host: 8080}] 7 | - ["forwarded_port", {guest: 5050, host: 5050}] 8 | 9 | provisioner: 10 | name: chef_zero 11 | require_chef_omnibus: latest 12 | 13 | platforms: 14 | - name: centos-7.2 15 | - name: centos-6.8 16 | - name: ubuntu-16.04 17 | - name: ubuntu-14.04 18 | suites: 19 | - name: default 20 | run_list: 21 | - recipe[mesos::master] 22 | - recipe[mesos::slave] 23 | - recipe[marathon] 24 | - recipe[marathon::service] 25 | attributes: 26 | marathon: 27 | flags: # run Marathon without ZooKeeper 28 | ha: false 29 | master: 'localhost:5050' 30 | internal_store_backend: 'mem' 31 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | ### Disable line length constraint 2 | Metrics/LineLength: 3 | Max: 120 4 | 5 | ### Comma after each line in a list 6 | Style/TrailingCommaInLiteral: 7 | EnforcedStyleForMultiline: comma 8 | 9 | ### Align hashes as a table 10 | Style/AlignHash: 11 | EnforcedColonStyle: table 12 | EnforcedHashRocketStyle: table 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | rvm: 2 | - 2.1.0 3 | - 2.3.1 4 | script: 5 | - bundle exec rake travis:ci 6 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # ^syntax detection 3 | 4 | source 'https://supermarket.chef.io' 5 | 6 | metadata 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | This project adheres to [Semantic Versioning](http://semver.org/). 4 | 5 | ## [2.2.0] - 2016-12-06 6 | 7 | ### Changed 8 | - Use poise_service 9 | - Default installed Marathon version is now 1.3.5 10 | - Test without installing ZooKeeper 11 | 12 | ### Bug fixes 13 | - Correct system umask 14 | 15 | ## [2.1.0] - 2015-12-26 16 | 17 | ### Changed 18 | - Complete refactor of cookbook 19 | - Default installed Marathon version is now 0.13.0 20 | - Default to logging to syslog 21 | - Manage Marathon process using Upstart 22 | 23 | ## [1.0.2] - 2014-10-31 24 | 25 | ### Bug fixes 26 | 27 | - Resolve gem dependecy for `marathon_app` LWRP 28 | - Pin `zookeeper` cookbook to known working version 29 | 30 | ## [1.0.1] - 2014-02-03 31 | 32 | ### New features 33 | 34 | - Add retry logic for exhibitor discover zookeepers method 35 | 36 | ## [1.0.0] - 2014-01-27 37 | 38 | ### New features 39 | 40 | - Release to open source 41 | 42 | ## [0.1.0] - 2013-10-09 43 | 44 | ### New features 45 | 46 | - Initial cookbook commit 47 | 48 | [2.2.0]: https://github.com/mdsol/marathon_cookbook/compare/2.1.0...2.2.0 49 | [2.1.0]: https://github.com/mdsol/marathon_cookbook/compare/1.0.2...2.1.0 50 | [1.0.2]: https://github.com/mdsol/marathon_cookbook/compare/1.0.1...1.0.2 51 | [1.0.1]: https://github.com/mdsol/marathon_cookbook/compare/1.0.0...1.0.1 52 | [1.0.0]: https://github.com/mdsol/marathon_cookbook/compare/0.1.0...1.0.0 53 | [0.1.0]: https://github.com/mdsol/marathon_cookbook/compare/0.1.0...0.1.0 54 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to the Marathon Cookbook 2 | ==================================== 3 | The Marathon cookbook uses GitHub to triage, manage, and track issues and pull 4 | requests to the cookbook. GitHub has excellent documentation on how to 5 | [fork a repository and start contributing](https://help.github.com/articles/fork-a-repo.). 6 | 7 | All contributors are welcome to submit patches, but we ask you keep the 8 | following guidelines in mind: 9 | 10 | - [Coding Standards](#coding-standards) 11 | - [Testing](#testing) 12 | - [Prerequisites](#prerequisites) 13 | 14 | Please also keep in mind: 15 | 16 | - Be patient as not all items will be tested or reviewed immediately by the core 17 | team. 18 | - Be receptive and responsive to feedback about your additions or changes. The 19 | core team and/or other community members may make suggestions or ask questions 20 | about your change. This is part of the review process, and helps everyone to 21 | understand what is happening, why it is happening, and potentially optimizes 22 | your code. 23 | - Be understanding. 24 | 25 | If you're looking to contribute but aren't sure where to start, check out the 26 | open issues. 27 | 28 | 29 | Will Not Merge 30 | -------------- 31 | This second details Pull Requests that we will **not** merge. 32 | 33 | 1. New features without accompanying Test Kitchen tests 34 | 1. New features without accompanying usage documentation 35 | 36 | 37 | Coding Standards 38 | ---------------- 39 | The submitted code should be compatible with the standard Ruby coding guidelines. 40 | Here are some additional resources: 41 | 42 | - [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide) 43 | - [GitHub Styleguide](https://github.com/styleguide/ruby) 44 | 45 | This cookbook is equipped with Rubocop, which will fail the build for violating 46 | these standards. 47 | 48 | 49 | Testing 50 | ------- 51 | Whether your pull request is a bug fix or introduces new classes or methods to the 52 | project, we kindly ask that you include tests for your changes. Even if it's just a 53 | small improvement, a test is necessary to ensure the bug is never re-introduced. 54 | 55 | We understand that not all users are familiar with the testing ecosystem. This cookbook 56 | is fully-tested using [Foodcritic](https://github.com/acrmp/foodcritic), 57 | [Rubocop](https://github.com/bbatsov/rubocop), and 58 | [Test Kitchen](https://github.com/test-kitchen/test-kitchen) with 59 | [Serverspec](https://github.com/serverspec/serverspec) bussers. 60 | 61 | 62 | Prerequisites 63 | ------------- 64 | In order to run the Test Kitchen integration suite, you must also have Vagrant and 65 | VirtualBox installed: 66 | 67 | - [Vagrant](https://vagrantup.com) 68 | - [VirtualBox](https://virtualbox.org) 69 | 70 | 71 | Process 72 | ------- 73 | 1. Clone the git repository from GitHub: 74 | 75 | $ git clone git@github.com:mdsol/marathon_cookbook.git 76 | 77 | 2. Install ChefDK for your platform: 78 | 79 | $ https://docs.chef.io/install_dk.html 80 | 81 | 3. Create a branch for your changes: 82 | 83 | $ git checkout -b my_bug_fix 84 | 85 | 4. Make any changes 86 | 5. Write tests to support those changes. 87 | 6. Run the tests: 88 | 89 | $ bundle exec rake 90 | 91 | 7. Assuming the tests pass, open a Pull Request on GitHub 92 | 93 | 94 | Do's and Don't's 95 | ---------------- 96 | - **Do** include tests for your contribution 97 | - **Do NOT** break existing behavior (unless intentional) 98 | - **Do NOT** modify the version number in the `metadata.rb` 99 | - **Do NOT** modify the CHANGELOG 100 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'berkshelf' 4 | gem 'chefspec' 5 | gem 'rubocop' 6 | gem 'serverspec' 7 | 8 | gem 'chef', '~> 12.0' 9 | # remove once we decide to drop support 10 | # for Chef < 12.14.60 and Ruby < 2.3.1 11 | if RUBY_VERSION < '2.2.0' 12 | gem 'buff-extensions', '< 2.0.0' 13 | gem 'fauxhai', '< 3.10.0' 14 | gem 'foodcritic', '< 8.0.0' 15 | else 16 | gem 'foodcritic' # rubocop:disable Bundler/DuplicatedGem 17 | end 18 | 19 | group :integration do 20 | gem 'kitchen-ec2' 21 | gem 'kitchen-vagrant' 22 | gem 'test-kitchen' 23 | end 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Medidata Solutions, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Marathon Cookbook 2 | ================= 3 | [![Build Status](https://secure.travis-ci.org/mdsol/marathon_cookbook.png?branch=master)](http://travis-ci.org/mdsol/marathon_cookbook) 4 | 5 | Description 6 | =========== 7 | 8 | Application cookbook for installing [Mesosphere][]'s [Marathon][]. 9 | [Marathon][] is an [Apache Mesos][] framework for long-running services. 10 | 11 | 12 | Requirements 13 | ============ 14 | 15 | Chef 12.0.0+ 16 | 17 | This cookbook also assumes you will be running a zookeeper cluster for 18 | production use of Mesos and Marathon. 19 | 20 | This cookbook also depends on the [mesos][] cookbook. 21 | 22 | The following cookbooks are dependencies: 23 | * [apt][] 24 | * [yum][] 25 | * [java][] 26 | * [mesos][] (used for installing the Mesos libraries) 27 | 28 | The following cookbooks are recommended: 29 | * zookeeper 30 | 31 | This cookbook is tested by running Marathon without ZooKeeper support, however 32 | it is currently not recommended to run it in this way in production. Please use 33 | a wrapper cookbook to set up a ZooKeeper + Mesos + Marathon stack in your 34 | environment. 35 | 36 | ## Platform: 37 | 38 | Tested on 39 | 40 | * Ubuntu 16.04 41 | * Ubuntu 14.04 42 | * CentOS 7.2 43 | * CentOS 6.8 44 | 45 | This cookbook includes cross-platform testing support via `test-kitchen`. 46 | 47 | 48 | Attributes 49 | ========== 50 | 51 | 52 | * `node['marathon']['version']` - Marathon version to install. 53 | * `node['marathon']['source']['url']` - Marathon tarball URL. 54 | * `node['marathon']['source']['checksum']` - Tarball SHA-256 checksum. 55 | 56 | * `node['marathon']['home']` - Home installation directory. Default: '/opt/marathon'. 57 | * `node['marathon']['user']` - The user to run tasks as on mesos slaves. Default: 'marathon'. 58 | * `node['marathon']['group']` - The group to run tasks as on mesos slaves. Default: 'marathon'. 59 | 60 | * `node['marathon']['jvm']['Xmx512m']` - JVM option. Default: 'true'. 61 | 62 | * `node['marathon']['flags']['master']` - The URL of the Mesos master. Default: 'zk://localhost:2181/mesos'. 63 | 64 | Note: Both the ['jvm'] and ['flags'] node support dynamic generation of all JVM 65 | and Marathon command line flags. Please read the 66 | [the wrapper template](templates/default/wrapper.erb) 67 | to see how these are generated. 68 | 69 | Development 70 | ----------- 71 | Please see the [Contributing](CONTRIBUTING.md) and 72 | [Issue Reporting](ISSUES.md) Guidelines. 73 | 74 | ## License and Author 75 | 76 | * Author: [Ray Rodriguez](https://github.com/rayrod2030)(rayrod2030@gmail.com) 77 | * Contributor: [Robert Veznaver](https://github.com/rveznaver)(robert.veznaver@gmail.com) 78 | 79 | Copyright 2015 Medidata Solutions Worldwide 80 | 81 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use 82 | this file except in compliance with the License. You may obtain a copy of the 83 | License at 84 | 85 | http://www.apache.org/licenses/LICENSE-2.0 86 | 87 | Unless required by applicable law or agreed to in writing, software distributed 88 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 89 | CONDITIONS OF ANY KIND, either express or implied. See the License for the 90 | specific language governing permissions and limitations under the License. 91 | 92 | [Apache Mesos]: http://mesos.apache.org 93 | [Netflix Exhibitor]: https://github.com/Netflix/exhibitor 94 | [Mesosphere]: http://mesosphere.io 95 | [Marathon]: http://mesosphere.github.io/marathon 96 | [exhibitor]: https://github.com/SimpleFinance/chef-exhibitor 97 | [apt]: https://github.com/opscode-cookbooks/apt 98 | [yum]: https://github.com/chef-cookbooks/yum 99 | [java]: https://github.com/agileorbit-cookbooks/java 100 | [mesos]: https://github.com/mdsol/mesos_cookbook 101 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/setup' 2 | 3 | namespace :style do 4 | require 'rubocop/rake_task' 5 | desc 'Run Ruby style checks' 6 | RuboCop::RakeTask.new(:ruby) 7 | 8 | require 'foodcritic' 9 | desc 'Run Chef style checks' 10 | FoodCritic::Rake::LintTask.new(:chef) 11 | end 12 | 13 | desc 'Run all style checks' 14 | task style: ['style:chef', 'style:ruby'] 15 | 16 | require 'kitchen' 17 | desc 'Run Test Kitchen integration tests' 18 | task :integration do 19 | Kitchen.logger = Kitchen.default_file_logger 20 | Kitchen::Config.new.instances.each do |instance| 21 | instance.test(:always) 22 | end 23 | end 24 | 25 | # We cannot run Test Kitchen on Travis CI yet... 26 | namespace :travis do 27 | desc 'Run tests on Travis' 28 | task ci: ['style'] 29 | end 30 | 31 | # The default rake task should just run it all 32 | task default: %w(style integration) 33 | -------------------------------------------------------------------------------- /Thorfile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'bundler' 4 | require 'bundler/setup' 5 | require 'berkshelf/thor' 6 | 7 | begin 8 | require 'kitchen/thor_tasks' 9 | Kitchen::ThorTasks.new 10 | rescue LoadError 11 | puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI'] 12 | end 13 | -------------------------------------------------------------------------------- /attributes/default.rb: -------------------------------------------------------------------------------- 1 | default['java']['jdk_version'] = '8' 2 | 3 | # Marathon package 4 | default['marathon']['version'] = '1.3.5' 5 | default['marathon']['source']['url'] = 6 | "http://downloads.mesosphere.com/marathon/v#{node['marathon']['version']}/marathon-#{node['marathon']['version']}.tgz" 7 | default['marathon']['source']['checksum'] = '298723dd54fd8c65c4cd9a052ca632a21e2d95133e328370fe2edede94a1804e' 8 | default['marathon']['syslog'] = true 9 | 10 | # Marathon user and directories 11 | default['marathon']['user'] = 'marathon' 12 | default['marathon']['group'] = 'marathon' 13 | default['marathon']['home'] = '/opt/marathon' 14 | 15 | # JVM flags 16 | default['marathon']['jvm']['Xmx512m'] = true 17 | 18 | # Marathon command line flags 19 | default['marathon']['flags']['master'] = 'zk://localhost:2181/mesos' 20 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | CHANGELOG* 81 | 82 | # Strainer # 83 | ############ 84 | Colanderfile 85 | Strainerfile 86 | .colander 87 | .strainer 88 | 89 | # Vagrant # 90 | ########### 91 | .vagrant 92 | Vagrantfile 93 | 94 | # Travis # 95 | ########## 96 | .travis.yml 97 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'marathon' 2 | maintainer 'Ray Rodriguez' 3 | maintainer_email 'rayrod2030@gmail.com' 4 | license 'Apache 2.0' 5 | description 'Installs/Configures Apache Marathon' 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version '2.2.0' 8 | source_url 'https://github.com/mdsol/marathon_cookbook' 9 | issues_url 'https://github.com/mdsol/marathon_cookbook/issues' 10 | 11 | %w(centos ubuntu).each do |os| 12 | supports os 13 | end 14 | 15 | # Cookbook dependencies 16 | %w(java apt yum mesos poise-service).each do |cb| 17 | depends cb 18 | end 19 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: marathon 3 | # Recipe:: default 4 | # 5 | # Copyright (C) 2013 Medidata Solutions, Inc. 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | include_recipe 'marathon::install' 20 | -------------------------------------------------------------------------------- /recipes/install.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: marathon 3 | # Recipe:: install 4 | # 5 | 6 | include_recipe 'java' 7 | include_recipe 'mesos' 8 | 9 | poise_service_user node['marathon']['user'] do 10 | group node['marathon']['group'] 11 | home node['marathon']['home'] 12 | end 13 | 14 | directory node['marathon']['home'] do 15 | owner node['marathon']['user'] 16 | group node['marathon']['group'] 17 | mode '0755' 18 | recursive true 19 | end 20 | 21 | pkg_location = ::File.join(Chef::Config[:file_cache_path], 'marathon.tgz') 22 | 23 | remote_file 'marathon-pkg' do 24 | path pkg_location 25 | mode '0644' 26 | source node['marathon']['source']['url'] 27 | checksum node['marathon']['source']['checksum'] 28 | end 29 | 30 | execute 'marathon-extract' do 31 | user node['marathon']['user'] 32 | group node['marathon']['group'] 33 | command "/bin/tar -xf #{pkg_location} -C #{node['marathon']['home']}" 34 | only_if { ::Dir.glob("#{node['marathon']['home']}/*#{node['marathon']['version']}").empty? } 35 | end 36 | 37 | template 'marathon-wrapper' do 38 | path ::File.join(node['marathon']['home'], 'wrapper') 39 | owner 'root' 40 | group 'root' 41 | mode '0755' 42 | source 'wrapper.erb' 43 | variables(lazy do 44 | { jar: ::Dir.glob("#{node['marathon']['home']}/*#{node['marathon']['version']}/target/*/*.jar").first.to_s, 45 | jvm: node['marathon']['jvm'], 46 | flags: node['marathon']['flags'], 47 | syslog: node['marathon']['syslog'] } 48 | end) 49 | end 50 | -------------------------------------------------------------------------------- /recipes/service.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: marathon 3 | # Recipe:: service 4 | # 5 | 6 | poise_service 'marathon' do 7 | user node['marathon']['user'] 8 | command ::File.join(node['marathon']['home'], 'wrapper') 9 | end 10 | -------------------------------------------------------------------------------- /templates/default/wrapper.erb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This file is generated by Chef 3 | 4 | <%- if @syslog -%> 5 | # stdout and stderr to syslog 6 | exec 1> >(exec logger -p user.info -t "marathon") 7 | exec 2> >(exec logger -p user.err -t "marathon") 8 | <%- end -%> 9 | 10 | # marathon jar configuration 11 | exec java \ 12 | <%- @jvm.sort.each do |option, value| -%> 13 | <%- if value -%> 14 | <%= "-#{option}" %><%= "=#{value}" if value.is_a? String %> \ 15 | <%- end -%> 16 | <%- end -%> 17 | -jar <%= @jar %> \ 18 | <%- @flags.sort.each do |flag, value| -%> 19 | <%- if value.is_a? String -%> 20 | <%= "--#{flag}" %><%= " \"#{value}\"" %> \ 21 | <%- else -%> 22 | <%= "--#{value ? '' : 'disable_'}#{flag}" %> \ 23 | <%- end -%> 24 | <%- end -%> 25 | -------------------------------------------------------------------------------- /test/integration/default/serverspec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :exec 4 | 5 | describe file('/opt/marathon/wrapper') do 6 | it { should be_file } 7 | end 8 | 9 | describe service('mesos-master') do 10 | it { should be_running } 11 | end 12 | 13 | describe service('mesos-slave') do 14 | it { should be_running } 15 | end 16 | 17 | describe service('marathon') do 18 | it { should be_running } 19 | end 20 | 21 | require 'json' 22 | require 'net/http' 23 | 24 | describe 'Mesos REST API' do 25 | state = JSON.parse(Net::HTTP.get('localhost', '/state.json', 5050)) 26 | 27 | it 'has an activated slave' do 28 | expect(state['activated_slaves']).to eq(1.0) 29 | end 30 | 31 | it 'has Marathon registered as a framework' do 32 | expect(state).to have_key('frameworks') 33 | expect(state['frameworks']).to include(include('name'=>'marathon')) 34 | end 35 | end 36 | --------------------------------------------------------------------------------