|
316 | 316 | (+ (:duration-millis requested-instance)
|
317 | 317 | (:time requested-instance))))))))))))))
|
318 | 318 |
|
319 |
| -(deftest ^:integration ca-files-test |
320 |
| - (testing "CA settings from puppet are honored and the CA |
321 |
| - files are created when the service starts up" |
322 |
| - (let [ca-files-test-runtime-dir (str master-service-test-runtime-dir |
323 |
| - "/ca-files-test") |
324 |
| - ca-files-test-puppet-conf (fs/file test-resources-path |
325 |
| - "ca_files_test/puppet.conf")] |
326 |
| - (fs/delete-dir ca-files-test-runtime-dir) |
327 |
| - (testutils/with-puppet-conf-files |
328 |
| - {"puppet.conf" ca-files-test-puppet-conf} |
329 |
| - ca-files-test-runtime-dir |
330 |
| - (logutils/with-test-logging |
331 |
| - (bootstrap-testutils/with-puppetserver-running |
332 |
| - app |
333 |
| - {:jruby-puppet {:gem-path gem-path |
334 |
| - :server-conf-dir ca-files-test-runtime-dir |
335 |
| - :max-active-instances 1} |
336 |
| - :webserver {:port 8081}} |
337 |
| - (let [jruby-service (tk-app/get-service app :JRubyPuppetService)] |
338 |
| - (jruby-service/with-jruby-puppet |
339 |
| - jruby-puppet jruby-service :ca-files-test |
340 |
| - (letfn [(test-path! |
341 |
| - [setting expected-path] |
342 |
| - (is (= (ks/absolute-path expected-path) |
343 |
| - (.getSetting jruby-puppet setting))) |
344 |
| - (is (fs/exists? (ks/absolute-path expected-path))))] |
345 |
| - |
346 |
| - (test-path! "capub" (str ca-files-test-runtime-dir "/ca/ca_pub.pem")) |
347 |
| - (test-path! "cakey" (str ca-files-test-runtime-dir "/ca/ca_key.pem")) |
348 |
| - (test-path! "cacert" (str ca-files-test-runtime-dir "/ca/ca_crt.pem")) |
349 |
| - (test-path! "localcacert" (str ca-files-test-runtime-dir "/ca/ca.pem")) |
350 |
| - (test-path! "cacrl" (str ca-files-test-runtime-dir "/ca/ca_crl.pem")) |
351 |
| - (test-path! "hostcrl" (str ca-files-test-runtime-dir "/ca/crl.pem")) |
352 |
| - (test-path! "hostpubkey" (str ca-files-test-runtime-dir "/public_keys/localhost.pem")) |
353 |
| - (test-path! "hostprivkey" (str ca-files-test-runtime-dir "/private_keys/localhost.pem")) |
354 |
| - (test-path! "hostcert" (str ca-files-test-runtime-dir "/certs/localhost.pem")) |
355 |
| - (test-path! "serial" (str ca-files-test-runtime-dir "/certs/serial")) |
356 |
| - (test-path! "cert_inventory" (str ca-files-test-runtime-dir "/inventory.txt"))))))))))) |
357 |
| - |
358 | 319 | (def graphite-enabled-config
|
359 | 320 | {:metrics {:server-id "localhost"
|
360 | 321 | :reporters {:graphite {:update-interval-seconds 5000
|
|
729 | 690 | (is (= 404 (:status resp)))))))
|
730 | 691 |
|
731 | 692 | (deftest ^:integration facts-upload-api
|
732 |
| - (bootstrap-testutils/with-puppetserver-running |
733 |
| - app |
734 |
| - {:jruby-puppet {:gem-path gem-path |
735 |
| - :max-active-instances 2 ; we need 2 jruby-instances since processing the upload uses an instance |
736 |
| - :server-code-dir test-resources-code-dir |
737 |
| - :server-conf-dir master-service-test-runtime-dir |
738 |
| - :server-var-dir (fs/tmpdir)}} |
739 |
| - (let [jruby-service (tk-app/get-service app :JRubyPuppetService) |
740 |
| - jruby-instance (jruby-testutils/borrow-instance jruby-service :facts-upload-endpoint-test) |
741 |
| - container (:scripting-container jruby-instance)] |
742 |
| - (try |
743 |
| - (let [facts (.runScriptlet container "facts = Puppet::Node::Facts.new('puppet.node.test') |
744 |
| - facts.values['foo'] = 'bar' |
745 |
| - facts.to_json") |
746 |
| - response (http-put "/puppet/v3/facts/puppet.node.test?environment=production" facts)] |
747 |
| - |
748 |
| - (testing "Puppet Server responds to PUT requests for /puppet/v3/facts" |
749 |
| - (is (= 200 (:status response)))) |
750 |
| - |
751 |
| - (testing "Puppet Server saves facts to the configured facts terminus" |
752 |
| - ;; Ensure the test is configured properly |
753 |
| - (is (= "yaml" (.runScriptlet container "Puppet::Node::Facts.indirection.terminus_class"))) |
754 |
| - (let [stored-facts (-> (.runScriptlet container "facts = Puppet::Node::Facts.indirection.find('puppet.node.test') |
755 |
| - (facts.nil? ? {} : facts).to_json") |
756 |
| - (json/parse-string))] |
757 |
| - (is (= "bar" (get-in stored-facts ["values" "foo"])))))) |
758 |
| - (finally |
759 |
| - (jruby-testutils/return-instance jruby-service jruby-instance :facts-upload-endpoint-test)))))) |
| 693 | + (let [tmpdir (fs/tmpdir)] |
| 694 | + (fs/mkdir (str tmpdir "/yaml")) |
| 695 | + (bootstrap-testutils/with-puppetserver-running |
| 696 | + app |
| 697 | + {:jruby-puppet {:gem-path gem-path |
| 698 | + :max-active-instances 2 ; we need 2 jruby-instances since processing the upload uses an instance |
| 699 | + :server-code-dir test-resources-code-dir |
| 700 | + :server-conf-dir master-service-test-runtime-dir |
| 701 | + :server-var-dir (fs/tmpdir)}} |
| 702 | + (let [jruby-service (tk-app/get-service app :JRubyPuppetService) |
| 703 | + jruby-instance (jruby-testutils/borrow-instance jruby-service :facts-upload-endpoint-test) |
| 704 | + container (:scripting-container jruby-instance)] |
| 705 | + (try |
| 706 | + (let [facts (.runScriptlet container "facts = Puppet::Node::Facts.new('puppet.node.test') |
| 707 | + facts.values['foo'] = 'bar' |
| 708 | + facts.to_json") |
| 709 | + response (http-put "/puppet/v3/facts/puppet.node.test?environment=production" facts)] |
| 710 | + |
| 711 | + (testing "Puppet Server responds to PUT requests for /puppet/v3/facts" |
| 712 | + (is (= 200 (:status response)))) |
| 713 | + |
| 714 | + (testing "Puppet Server saves facts to the configured facts terminus" |
| 715 | + ;; Ensure the test is configured properly |
| 716 | + (is (= "yaml" (.runScriptlet container "Puppet::Node::Facts.indirection.terminus_class"))) |
| 717 | + (let [stored-facts (-> (.runScriptlet container "facts = Puppet::Node::Facts.indirection.find('puppet.node.test') |
| 718 | + (facts.nil? ? {} : facts).to_json") |
| 719 | + (json/parse-string))] |
| 720 | + (is (= "bar" (get-in stored-facts ["values" "foo"])))))) |
| 721 | + (finally |
| 722 | + (jruby-testutils/return-instance jruby-service jruby-instance :facts-upload-endpoint-test))))))) |
760 | 723 |
|
761 | 724 | (deftest ^:integration v4-queue-limit
|
762 | 725 | (bootstrap-testutils/with-puppetserver-running
|
|
0 commit comments