テスト書かない奴は死刑!
ということで、groovyのテストかいてみます。
コード
みぢかっ!
テスト
実行
グリーン。
今日のブログもう終わってしまった…つづく!
かねこ(-∧-;)
2012年9月23日日曜日
2012年9月11日火曜日
最強の開発環境をつくるぞ!
本気でやるぞ!
というわけで、グランドデザインのラフつくりました。イマイチ!
トモチンに「もっとかっこよくしたい!」って相談したら、「モノクロにするとかっこよくなりますよ~」って言われたんだけど、モノクロのやりかたはおしえてくれませんでした
(-∧-;) あいつめ。
現在導入済みの環境は、
次はとりあえず全部つないじゃうのがわかりやすくていいだろうと思うので、iRCサーバ作って導入済みプロダクトの通知をバンバン飛ばしてみたい!
よって次回は、iRCサーバをたちあげてみたいと思います。
楽しみ!
かねこ(゜-゜)
トモチンに「もっとかっこよくしたい!」って相談したら、「モノクロにするとかっこよくなりますよ~」って言われたんだけど、モノクロのやりかたはおしえてくれませんでした
(-∧-;) あいつめ。
現在導入済みの環境は、
- Jenkins
- SVN
- Redmine
- Aipo
- サーバ死活監視
ほかにもあったっけな?
次はとりあえず全部つないじゃうのがわかりやすくていいだろうと思うので、iRCサーバ作って導入済みプロダクトの通知をバンバン飛ばしてみたい!
よって次回は、iRCサーバをたちあげてみたいと思います。
楽しみ!
かねこ(゜-゜)
2012年1月27日金曜日
vs Travis CI
CIサーバの用意めんどくさいから、オンラインのJenkinsあったらいいのになーと思っていたら、githubのリポジトリをそのまま使える、Travis CIというCIをみつけました。
とりあえずgithubのOAuthでログインして雰囲気をみて終了。
で、その後ちょっとだけコードかいたりしていたら、gmailにメールがいっぱい!!!

どうやらいつのまにか、自分のリポジトリをCI対象にしていたようだ。
ということで、せっかくなのでStill Failingを解決してずっと使えるようにしようと思います。
まず調査。
Rubyでテストしようとしてる(笑)
.travis.ymlをリポジトリルートにおいてPHPを指定しないといけないらしい。 ということで、追加。
.travis.yml
できた。
CakePHPの場合、通常はphpunitコマンドじゃなくてcakeコマンドでテスト実行するので、スクリプトを.travis.ymlに追加してみる。
.travis.yml
パーミッションあるのか。
.travis.yml
テスト用データベースに接続できなかった。
作る。
.travis.yml
そういえば、コンフィグファイルなかった。
.travis.yml
グリーン!!やったね!
SCMもCIもクラウドの時代ですよ、というわけで、おやすみなさい。
かねこ(^ν^)
とりあえずgithubのOAuthでログインして雰囲気をみて終了。
で、その後ちょっとだけコードかいたりしていたら、gmailにメールがいっぱい!!!
どうやらいつのまにか、自分のリポジトリをCI対象にしていたようだ。
ということで、せっかくなのでStill Failingを解決してずっと使えるようにしようと思います。
まず調査。
1Using worker: ruby2.worker.travis-ci.org:travis-ruby-63$ cd ~/builds4$ git clone --depth=100 --quiet git://github.com/e2kaneko/SocialLoginExamples.git e2kaneko/SocialLoginExamples5$ cd e2kaneko/SocialLoginExamples6$ git checkout -qf 4bea04f3da2290593d511804e3274821429835c17$ export TRAVIS_RUBY_VERSION=default8$ rvm use default9Using /home/vagrant/.rvm/gems/ruby-1.8.7-p35710$ ruby --version11ruby 1.8.7 (2011-12-28 patchlevel 357) [i686-linux]12$ gem --version131.8.1514$ rake15rake aborted!
Rubyでテストしようとしてる(笑)
.travis.ymlをリポジトリルートにおいてPHPを指定しないといけないらしい。 ということで、追加。
.travis.yml
language: php
php:
- 5.3
- 5.4
php:
- 5.3
- 5.4
Using worker: php1.worker.travis-ci.org:travis-php-13$ cd ~/builds4$ git clone --depth=100 --quiet git://github.com/e2kaneko/SocialLoginExamples.git e2kaneko/SocialLoginExamples5$ cd e2kaneko/SocialLoginExamples6$ git checkout -qf 479e254740fa4be905cfbc392eb640aa27044dfa7$ phpenv global 5.38$ php --version9PHP 5.3.9 (cli) (built: Jan 22 2012 13:00:07)10Copyright (c) 1997-2012 The PHP Group11Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies12 with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans13$ phpunit14PHPUnit 3.6.8 by Sebastian Bergmann.16Usage: phpunit [switches] UnitTest [UnitTest.php]17 phpunit [switches] <directory>
できた。
CakePHPの場合、通常はphpunitコマンドじゃなくてcakeコマンドでテスト実行するので、スクリプトを.travis.ymlに追加してみる。
.travis.yml
language: php
php:
- 5.3
- 5.4
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
php:
- 5.3
- 5.4
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
19$ ./lib/Cake/Console/cake testsuite core AllTests --stderr20-bash: ./lib/Cake/Console/cake: Permission denied
パーミッションあるのか。
.travis.yml
language: php
php:
- 5.3
- 5.4
before_script:
- chmod -R 777 ./lib/Cake/Console/cake
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
php:
- 5.3
- 5.4
before_script:
- chmod -R 777 ./lib/Cake/Console/cake
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
19Welcome to CakePHP v2.0.4 Console20---------------------------------------------------------------21App : app22Path: /home/vagrant/builds/e2kaneko/SocialLoginExamples/app/23---------------------------------------------------------------24CakePHP Test Shell25---------------------------------------------------------------26Error: Database connection "SQLSTATE[42000] [1049] Unknown database 'test'" is missing, or could not be created.27#0
テスト用データベースに接続できなかった。
作る。
.travis.yml
language: php
php:
- 5.3
- 5.4
env:
- DB=mysql
before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test;'; fi"
- chmod -R 777 ./lib/Cake/Console/cake
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
php:
- 5.3
- 5.4
env:
- DB=mysql
before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test;'; fi"
- chmod -R 777 ./lib/Cake/Console/cake
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
13$ phpunit14PHP Notice: Undefined offset: 0 in /home/vagrant/.phpenv/versions/5.3.9/share/pyrus/.pear/php/PHPUnit/Util/Configuration.php on line 86015PHP Stack trace:
そういえば、コンフィグファイルなかった。
.travis.yml
language: php
php:
- 5.3
- 5.4
env:
- DB=mysql
before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test;'; fi"
- chmod -R 777 ./lib/Cake/Console/cake
- cp ./app/Config/const.php.default ./app/Config/const.php
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
php:
- 5.3
- 5.4
env:
- DB=mysql
before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE test;'; fi"
- chmod -R 777 ./lib/Cake/Console/cake
- cp ./app/Config/const.php.default ./app/Config/const.php
script:
- ./lib/Cake/Console/cake testsuite app AllTests --stderr
グリーン!!やったね!
SCMもCIもクラウドの時代ですよ、というわけで、おやすみなさい。
かねこ(^ν^)
2011年12月18日日曜日
FacebookのCIのはなし
「Facebookには、テストサーバが存在しない。すべての開発者は本番サーバで直接開発・リリースしている。」という話があるようですが、少なくとも開発者ならこの話を文面通りに受け取る人はいないはずで、CIでバッチリ管理してるだろうということで、少し調べてみた。
まず、
テストちゃんとやってますよ、と。
まず、
- http://www.quora.com/What-kind-of-automated-testing-does-Facebook-do
- For our PHP code, we have a suite of a few thousand test classes using the PHPUnit framework. They range in complexity from simple true unit tests to large-scale integration tests that hit our production backend services. The PHPUnit tests are run both by developers as part of their workflow and continuously by an automated test runner on dedicated hardware. Our developer tools automatically use code coverage data to run tests that cover the outstanding edits in a developer sandbox, and a report of test results is automatically included in our code review tool when a patch is submitted for review.
- For browser-based testing of our Web code, we use the Watir framework. We have Watir tests covering a range of the site's functionality, particularly focused on privacy there are tons of "user X posts item Y and it should/shouldn't be visible to user Z" tests at the browser level. (Those privacy rules are, of course, also tested at a lower level, but the privacy implementation being rock-solid is a critical priority and warrants redundant test coverage.)
テストちゃんとやってますよ、と。
Watirてのは初めて聞いた。こんどドキュメント見てみよう。
そして、
- http://framethink.blogspot.com/2011/01/how-facebook-ships-code.html
- ops team runs code releases by gradually rolling code out
- facebook has around 60,000 servers
- there are 9 concentric levels for rolling out new code
- [CORRECTION thx epriest] "The nine push phases are not concentric. There are three concentric phases (p1 = internal release, p2 = small external release, p3 = full external release). The other six phases are auxiliary tiers like our internal tools, video upload hosts, etc."
- the smallest level is only 6 servers
- e.g., new tuesday release is rolled out to 6 servers (level 1), ops team then observes those 6 servers and make sure that they are behaving correctly before rolling forward to the next level.
- if a release is causing any issues (e.g., throwing errors, etc.) then push is halted. the engineer who committed the offending changeset is paged to fix the problem. and then the release starts over again at level 1.
- so a release may go thru levels repeatedly: 1-2-3-fix. back to 1. 1-2-3-4-5-fix. back to 1. 1-2-3-4-5-6-7-8-9.
サーバ多くなってくると、いろいろな工夫が必要になってくるね!
かねこ(・ε・)
登録:
投稿 (Atom)

