-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split up tests to support enterprise/non-enterprise tests
- Loading branch information
1 parent
9f9a251
commit dddc6af
Showing
4 changed files
with
107 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// +build !ent | ||
|
||
package config | ||
|
||
import ( | ||
"github.com/hashicorp/consul/agent/structs" | ||
) | ||
|
||
func (b *Builder) validateSegments(rt RuntimeConfig) error { | ||
if rt.SegmentName != "" { | ||
return structs.ErrSegmentsNotSupported | ||
} | ||
if len(rt.Segments) > 0 { | ||
return structs.ErrSegmentsNotSupported | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// +build !ent | ||
|
||
package config | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/consul/testutil" | ||
) | ||
|
||
func TestSegments(t *testing.T) { | ||
dataDir := testutil.TempDir(t, "consul") | ||
defer os.RemoveAll(dataDir) | ||
|
||
tests := []configTest{ | ||
{ | ||
desc: "segment name not in OSS", | ||
flags: []string{ | ||
`-data-dir=` + dataDir, | ||
}, | ||
json: []string{`{ "server": true, "segment": "a" }`}, | ||
hcl: []string{` server = true segment = "a" `}, | ||
err: `Network segments are not supported in this version of Consul`, | ||
}, | ||
{ | ||
desc: "segments not in OSS", | ||
flags: []string{ | ||
`-data-dir=` + dataDir, | ||
}, | ||
json: []string{`{ "segments":[{ "name":"x", "advertise": "unix:///foo" }] }`}, | ||
hcl: []string{`segments = [{ name = "x" advertise = "unix:///foo" }]`}, | ||
err: `Network segments are not supported in this version of Consul`, | ||
}, | ||
} | ||
|
||
testConfig(t, tests, dataDir) | ||
} |