Browse Source

fixing unit tests

Eugene Yakubovich 10 years ago
parent
commit
81c7a69ceb
2 changed files with 14 additions and 14 deletions
  1. 13 13
      subnet/config_test.go
  2. 1 1
      subnet/subnet_test.go

+ 13 - 13
subnet/config_test.go

@@ -17,21 +17,21 @@ func TestConfigDefaults(t *testing.T) {
 		t.Errorf("Network mismatch: expected %s, got %s", expectedNet, cfg.Network)
 	}
 
-	if cfg.FirstIP.String() != "10.3.0.0" {
-		t.Errorf("FirstIP mismatch, expected 10.3.0.0, got %s", cfg.FirstIP)
+	if cfg.SubnetMin.String() != "10.3.1.0" {
+		t.Errorf("SubnetMin mismatch, expected 10.3.1.0, got %s", cfg.SubnetMin)
 	}
 
-	if cfg.LastIP.String() != "10.3.255.0" {
-		t.Errorf("LastIP mismatch, expected 10.3.255.0, got %s", cfg.LastIP)
+	if cfg.SubnetMax.String() != "10.3.255.0" {
+		t.Errorf("SubnetMax mismatch, expected 10.3.255.0, got %s", cfg.SubnetMax)
 	}
 
-	if cfg.HostSubnet != 24 {
-		t.Errorf("HostSubnet mismatch: expected 24, got %d", cfg.HostSubnet)
+	if cfg.SubnetLen != 24 {
+		t.Errorf("SubnetLen mismatch: expected 24, got %d", cfg.SubnetLen)
 	}
 }
 
 func TestConfigOverrides(t *testing.T) {
-	s := `{ "Network": "10.3.0.0/16", "FirstIP": "10.3.5.0", "LastIP": "10.3.8.0", "HostSubnet": 28 }`
+	s := `{ "Network": "10.3.0.0/16", "SubnetMin": "10.3.5.0", "SubnetMax": "10.3.8.0", "SubnetLen": 28 }`
 
 	cfg, err := ParseConfig(s)
 	if err != nil {
@@ -43,15 +43,15 @@ func TestConfigOverrides(t *testing.T) {
 		t.Errorf("Network mismatch: expected %s, got %s", expectedNet, cfg.Network)
 	}
 
-	if cfg.FirstIP.String() != "10.3.5.0" {
-		t.Errorf("FirstIP mismatch: expected 10.3.5.0, got %s", cfg.FirstIP)
+	if cfg.SubnetMin.String() != "10.3.5.0" {
+		t.Errorf("SubnetMin mismatch: expected 10.3.5.0, got %s", cfg.SubnetMin)
 	}
 
-	if cfg.LastIP.String() != "10.3.8.0" {
-		t.Errorf("LastIP mismatch: expected 10.3.8.0, got %s", cfg.LastIP)
+	if cfg.SubnetMax.String() != "10.3.8.0" {
+		t.Errorf("SubnetMax mismatch: expected 10.3.8.0, got %s", cfg.SubnetMax)
 	}
 
-	if cfg.HostSubnet != 28 {
-		t.Errorf("HostSubnet mismatch: expected 28, got %d", cfg.HostSubnet)
+	if cfg.SubnetLen != 28 {
+		t.Errorf("SubnetLen mismatch: expected 28, got %d", cfg.SubnetLen)
 	}
 }

+ 1 - 1
subnet/subnet_test.go

@@ -41,7 +41,7 @@ func (msr *mockSubnetRegistry) getConfig() (*etcd.Response, error) {
 	return &etcd.Response{
 		EtcdIndex: msr.index,
 		Node: &etcd.Node{
-			Value: `{ "Network": "10.3.0.0/16", "FirstIP": "10.3.1.0", "LastIP": "10.3.5.0" }`,
+			Value: `{ "Network": "10.3.0.0/16", "SubnetMin": "10.3.1.0", "SubnetMax": "10.3.5.0" }`,
 		},
 	}, nil
 }