<commit_before>(ns celestial.integration.networking
  (:use midje.sweet)
  (:require 
    [celestial.fixtures.core :refer [with-conf]]  
    [hypervisors.networking :as n :refer (initialize-range long-to-ip list-used-ips clear-range)])
 )

(with-conf
  (with-state-changes [(before :facts (do (clear-range :proxmox) (n/initialize-networking)))]
    (fact "used up ips marking" :integration :redis :ip
      (n/gen-ip {} :proxmox :ip_address)  => {:ip_address "192.168.5.100"}
      (count (n/list-free-ips :proxmox)) => 152
      (n/list-used-ips :proxmox) => ["192.168.5.100" "192.168.5.170" "192.168.5.171" "192.168.5.173"]
      (n/release-ip "192.168.5.100" :proxmox)
      (n/list-used-ips :proxmox) => ["192.168.5.170" "192.168.5.171" "192.168.5.173"]
      (count (n/list-free-ips :proxmox)) => 153)

    (fact "multiple ips" :integration :redis :ip
      (dotimes [_ 5] (n/gen-ip {} :proxmox :ip_address))
      (count (n/list-free-ips :proxmox)) => 148
      (dotimes [i 5] (n/release-ip (str  "192.168.5.10" i) :proxmox)) 
      (count (n/list-free-ips :proxmox)) => 153)
    ))

<commit_msg>matching results to new subnet<commit_after>(ns celestial.integration.networking
  (:use midje.sweet)
  (:require 
    [celestial.fixtures.core :refer [with-conf]]  
    [hypervisors.networking :as n :refer (initialize-range long-to-ip list-used-ips clear-range)])
 )

(with-conf
  (with-state-changes [(before :facts (do (clear-range :proxmox) (n/initialize-networking)))]
    (fact "used up ips marking" :integration :redis :ip
      (n/gen-ip {} :proxmox :ip_address)  => {:ip_address "192.168.3.200"}
      (count (n/list-free-ips :proxmox)) => 52
      (n/list-used-ips :proxmox) => ["192.168.3.200" "192.168.3.230" "192.168.3.231" "192.168.3.232"]
      (n/release-ip "192.168.3.200" :proxmox)
      (n/list-used-ips :proxmox) => ["192.168.3.230" "192.168.3.231" "192.168.3.232"]
      (count (n/list-free-ips :proxmox)) => 53)

    (fact "multiple ips" :integration :redis :ip
      (dotimes [_ 5] (n/gen-ip {} :proxmox :ip_address))
      (count (n/list-free-ips :proxmox)) => 48
      (dotimes [i 5] (n/release-ip (str  "192.168.3.20" i) :proxmox)) 
      (count (n/list-free-ips :proxmox)) => 53)
    ))


{'fraction_non_alphanumeric': 0.20027063599458728, 'fraction_numerical': 0.10013531799729364, 'mean_word_length': 3.0847145488029466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 20, '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': '2481710', 'n_tokens_mistral': 1093, 'n_tokens_neox': 914, 'n_words': 176}