5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CircleCIでRedisへの読み書きの単体テストを実行する

Posted at

はじめに

高速に動作するキャッシュとしてRedisを使うことがよくあります。しかし、書き込み、読み込みのテストをするために、毎回Redisサーバーをインストールして起動してとやるのは面倒です。CircleCIならきっと便利な機能が用意されているはず、ということで調査した話です。

結論

.circleci/config.yml
jobs:
  test:
    docker:
      - image: circleci/python:3.6.1
      - image: redis:3.2.11
    steps: 
      - checkout 
      - run:
          name: run unittest
          command: |
            python -m unittest discover tests/

- image: redis:3.2.11を記述するだけです。
この状態でテストの中で、localhost:6379への読み書きを記述すると、Redisサーバーに接続できるようになっています。

参考

5
4
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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?