Checkpoint
[pwan.org.git] / content / lessons / Certmaster.rst
1 Certmaster lessons learned
2 ##########################
3
4 :date: 2015-12-18
5 :tags: lessons,certmaster
6 :category: lessons
7 :author: Jude N
8
9 I'm started occassional series about lessons I've learned after finishing with a project. The kick-off article is about a `certmaster`_ fork I've been working on.
10 I've been using certmaster at $work for a few years now, but when we wanted to start using multiple certificate authorities, we had to spin up different instances of certmaster, with each instance
11 using on its own IP/port. It would be better if a single instance of certmaster could serve multiple CA's by adding a '--ca' flag. This is the functionality that `my fork of certmaster`_ provides, and
12 here are the lessons I learned while working on this:
13
14 bats versus shunit2
15 -------------------
16 certmaster doesn't include any tests, so I wanted to write some functional tests to verify my changes worked as expected.
17
18 I started out working with `bats_`, but it fell down when I needed to push a command into the background - it just wouldn't do it. I tried the 'gotcha' suggestions from `this engine yard post`_ but to no avail.
19 I switched the tests to `shunit2`_ and had no trouble pushing commands into the background.
20
21 Assigning here documents to variables
22 -------------------------------------
23
24 .. code-block:: bash
25
26 variable=$(cat <<EOF
27 this text will get assigned to variable.
28 EOF
29
30
31 .. _certmaster: https://fedorahosted.org/certmaster/
32 .. _my fork of certmaster: https://pwan.org/git/?p=certmaster.git;a=summary
33 .. _bats: https://github.com/sstephenson/bats
34 .. _this engine yard post: https://blog.engineyard.com/2014/bats-test-command-line-tools
35 .. _shunit2: https://code.google.com/p/shunit2/
36