yugabytedb: added single rf container command test

adds test to verify container create command with RF=1

Signed-off-by: Arnav Agarwal <14933889+Arnav15@users.noreply.github.com>
This commit is contained in:
Arnav Agarwal committed 2020-01-10 15:02:14 -08:00
1 parent 17d5ab65a5
commit 11244925ed
1 file changed
+37 -11
+37 -11
View File
@@ -261,6 +261,40 @@ func TestGetPortsFromSpec(t *testing.T) {
func TestCreateMasterContainerCommand(t *testing.T) {
replicationFactor := int32(3)
expectedCommand := getMasterContainerCommand(replicationFactor)
actualCommand := createMasterContainerCommand("default", masterNamePlural, masterName, int32(7100), replicationFactor)
assert.Equal(t, expectedCommand, actualCommand)
}
func TestCreateTServerContainerCommand(t *testing.T) {
replicationFactor := int32(3)
expectedCommand := getTserverContainerCommand(replicationFactor)
actualCommand := createTServerContainerCommand("default", tserverNamePlural, masterNamePlural, masterName, int32(7100), int32(9100), int32(5433), replicationFactor)
assert.Equal(t, expectedCommand, actualCommand)
}
func TestCreateMasterContainerCommandRF1(t *testing.T) {
replicationFactor := int32(1)
expectedCommand := getMasterContainerCommand(replicationFactor)
actualCommand := createMasterContainerCommand("default", masterNamePlural, masterName, int32(7100), replicationFactor)
assert.Equal(t, expectedCommand, actualCommand)
}
func TestCreateTServerContainerCommandRF1(t *testing.T) {
replicationFactor := int32(1)
expectedCommand := getTserverContainerCommand(replicationFactor)
actualCommand := createTServerContainerCommand("default", tserverNamePlural, masterNamePlural, masterName, int32(7100), int32(9100), int32(5433), replicationFactor)
assert.Equal(t, expectedCommand, actualCommand)
}
func getMasterContainerCommand(replicationFactor int32) []string {
expectedCommand := []string{
"/home/yugabyte/bin/yb-master",
"--fs_data_dirs=/mnt/data0",
@@ -272,15 +306,10 @@ func TestCreateMasterContainerCommand(t *testing.T) {
fmt.Sprintf("--replication_factor=%d", replicationFactor),
"--logtostderr",
}
actualCommand := createMasterContainerCommand("default", masterNamePlural, masterName, int32(7100), replicationFactor)
assert.Equal(t, expectedCommand, actualCommand)
return expectedCommand
}
func TestCreateTServerContainerCommand(t *testing.T) {
replicationFactor := int32(3)
func getTserverContainerCommand(replicationFactor int32) []string {
expectedCommand := []string{
"/home/yugabyte/bin/yb-tserver",
"--fs_data_dirs=/mnt/data0",
@@ -292,10 +321,7 @@ func TestCreateTServerContainerCommand(t *testing.T) {
"--enable_ysql=true",
"--logtostderr",
}
actualCommand := createTServerContainerCommand("default", tserverNamePlural, masterNamePlural, masterName, int32(7100), int32(9100), int32(5433), replicationFactor)
assert.Equal(t, expectedCommand, actualCommand)
return expectedCommand
}
func TestOnAdd(t *testing.T) {