LoginSignup
3
3

More than 5 years have passed since last update.

serverspecでUbuntuのppaが登録されているかテストする

Last updated at Posted at 2014-05-21

発端

serverspecでテスト書いている時に、servserspecのマニュアルにはyumrepoを使えば、

describe yumrepo('epel') do
  it { should exist }
  it { should be_enabled }
end

のような書き方ができるのに、
ppa('launchpad-username/ppa-name')のような書き方が出来ないじゃん!
ということで書けるようにしてみた。

送ったPR

specinfraのリポジトリには specinfra pull#117 により、泥くさく/etc/aptの下にppaのsource.listが置かれてないか調べるメソッドを追加した。

serverspecのリポジトリには serverspec pull#407 により、yumrepoと同じようなspecが書けるようにした。

specinfra pull#121 により、ppa:があってもなくてもapt-lineにあったURIに変換されるようになってます。

Resource Type: ppa の書き方

例えば、Ubuntu向けの比較的新しいRubyのパッケージを提供するPPAのhttps://launchpad.net/~brightbox/+archive/ruby-ng 向けのspecは次のようになる。

ppa:brightbox/ruby-ngbrightbox/ruby-ng の形式で渡す:

describe ppa('ppa:brightbox/ruby-ng') do
  it { should exist }
  it { should be_enabled }
end

これでUbuntuのPPAがaptリポジトリに追加されている&有効になっているかをテストするserverspecが書けるようになります。

enjoy serverspec!

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3