| 121 | | This method should have almost no logic. But it still deserves some testing. It must receive a valid `EDG::CCM::Configuration` object from a profile. And handling this is done by `Test::Quattor`. |
| | 121 | This method should have almost no logic. But it still deserves some testing. It must receive a valid `EDG::CCM::Configuration` object from a profile. And handling this is done by `Test::Quattor`. This is how we do it: |
| | 122 | |
| | 123 | 1. We have a set of test profiles. They are minimalistic, and have no dependencies on any "standard" templates. Just assign a few values to fill in your component structure. For instance: |
| | 124 | {{{ |
| | 125 | #!sh |
| | 126 | object template test_profile; |
| | 127 | |
| | 128 | prefix "/software/components/foo"; |
| | 129 | "a" = 1; |
| | 130 | "b" = 2; |
| | 131 | }}} |
| | 132 | 1. This profile must be compiled, and a cache must be created for it. The `Test::Quattor` comes in hand here: If you pass any arguments to it, it will compile them and prepare the correct cache: |
| | 133 | {{{ |
| | 134 | #!perl |
| | 135 | use Test::Quattor qw(test_profile another_test_profile); |
| | 136 | }}} |
| | 137 | 1. And then, you'll want it to serve you the configuration for some of these, right? |
| | 138 | {{{ |
| | 139 | #!perl |
| | 140 | my $config = get_config_for_profile("test_profile"); |
| | 141 | }}} |
| | 142 | 1. And now, you can just run `Configure` on it: |
| | 143 | {{{ |
| | 144 | #!perl |
| | 145 | $comp->Configure($config); |
| | 146 | }}} |
| | 147 | |
| | 148 | And test whatever you need to test. Simple, right? |