               (str "the metadata should be in the environment\n"
                    "the test is in check-metadata.bash"))
           (testing "existing BUILD_METADATA environment is respected"
-            (with-redefs [environ/env {:build-metadata "existing;metadata"}]
+            (with-redefs [environ/env (assoc environ/env
+                                             :build-metadata
+                                             "existing;metadata")]
               (let [[opts-periodic res-periodic]
                     (run (conj
                           ["-c" "test/config/main.yml"

        intake-dir "tmp/git/metadata-intake"
        periodic-dir "tmp/git/metadata-periodic"]
    (try
      (when (.exists (jio/file periodic-dir))
        (io/rmdir-r periodic-dir))
      (when (.exists (jio/file intake-dir))
        (io/rmdir-r intake-dir))
      (with-redefs [email/send* (fn [_ _ _ _ _ plain html attachments]
                                  (reset! email-body html)
                                  ;; to satisfy schema

                          "test/check-existing-metadata.bash"))]
                ;; 0 exit code means the second script got the
                ;; metadata- the check is in the bash script
                (is (= 0 (:exit-code res-periodic))
                    (str "the metadata was incorrect in the environment\n"
                         "the test is in check-existing-metadata.bash")))))))
