<commit_before>(ns celestial.features.kvm
  (:require 
    [celestial.persistency.systems :as s]
    [celestial.model :refer (vconstruct)]
    [celestial.fixtures.core :refer (with-conf with-admin is-type?) :as f]
    [celestial.fixtures.data :refer (redis-type local-conf redis-gce)]  
    [celestial.fixtures.populate :refer (populate-system)]  
    [celestial.integration.workflows.common :refer (spec)]
    [celestial.workflows :as wf]
    [celestial.fixtures.data :refer [redis-kvm]])
  (:use midje.sweet)
  (:import clojure.lang.ExceptionInfo)
 )

(with-conf
  (let [{:keys [machine kvm]} redis-gce]
    (fact "legal instance spec" :kvm
      (let [domain (vconstruct (assoc redis-kvm :system-id 1))]
        (:system-id domain ) => 1
        (:node domain)  => (just {:user "ronen" :host "localhost" :port 22})
        (:domain domain) => 
          (just {
            :user "celestial" :name "red1.local" 
            :image {:flavor :debian :template "ubuntu-15.04"}
            :cpu 2 :ram 1024
           })))))

(with-admin
  (with-conf local-conf
    (with-state-changes [(before :facts (populate-system redis-type redis-kvm))]
      (fact "kvm creation workflows" :integration :kvm :workflow
           (wf/create (spec)) => nil 
           (wf/stop (spec)) => nil 
           (wf/start (spec)) => nil 
           (wf/destroy (spec)) => nil
          ))))<commit_msg>adding puppet use cases<commit_after>(ns celestial.features.kvm
  (:require 
    [celestial.persistency.systems :as s]
    [celestial.model :refer (vconstruct)]
    [celestial.fixtures.core :refer (with-conf with-admin is-type?) :as f]
    [celestial.fixtures.data :refer (redis-type local-conf redis-gce)]  
    [celestial.fixtures.populate :refer (populate-system)]  
    [celestial.integration.workflows.common :refer (spec)]
    [celestial.workflows :as wf]
    [celestial.fixtures.data :refer [redis-kvm]])
  (:use midje.sweet)
  (:import clojure.lang.ExceptionInfo)
 )

(with-conf
  (let [{:keys [machine kvm]} redis-gce]
    (fact "legal instance spec" :kvm
      (let [domain (vconstruct (assoc redis-kvm :system-id 1))]
        (:system-id domain ) => 1
        (:node domain)  => (just {:user "ronen" :host "localhost" :port 22})
        (:domain domain) => 
          (just {
            :user "celestial" :name "red1.local" 
            :image {:flavor :debian :template "ubuntu-15.04"}
            :cpu 2 :ram 1024
           })))))

(with-admin
  (with-conf local-conf
    (with-state-changes [(before :facts (populate-system redis-type redis-kvm))]
      (fact "kvm creation workflows" :integration :kvm :workflow
           (wf/create (spec)) => nil 
           (wf/stop (spec)) => nil 
           (wf/start (spec)) => nil 
           (wf/destroy (spec)) => nil
          )

      (fact "kvm puppetization" :integration :kvm :workflow :puppet
        (wf/create (spec)) => nil
        (wf/provision redis-type (spec)) => nil 
        (wf/destroy (spec)) => nil)
      )))
{'fraction_non_alphanumeric': 0.15493432132030988, 'fraction_numerical': 0.009430784776018861, 'mean_word_length': 2.5826296743063932, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2624125', 'n_tokens_mistral': 1094, 'n_tokens_neox': 999, 'n_words': 242}