-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BEAM-13873] [Playground] Increase test coverage for the environment package #16946
Changes from 1 commit
dd98bf1
ab3762b
5f85353
36aad31
1f1bf24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ func TestNetworkEnvs_Address(t *testing.T) { | |
want string | ||
}{ | ||
{ | ||
name: "ip and port concatenated through ':'", | ||
name: "Ip and port concatenated through ':'", | ||
fields: fields{ip: defaultIp, port: defaultPort}, | ||
want: fmt.Sprintf("%s:%d", defaultIp, defaultPort), | ||
}, | ||
|
@@ -63,7 +63,7 @@ func TestCacheEnvs_CacheType(t *testing.T) { | |
want string | ||
}{ | ||
{ | ||
name: "all success", | ||
name: "All success", | ||
fields: fields{ | ||
cacheType: "MOCK_CACHE_TYPE", | ||
address: "MOCK_ADDRESS", | ||
|
@@ -98,7 +98,7 @@ func TestCacheEnvs_Address(t *testing.T) { | |
want string | ||
}{ | ||
{ | ||
name: "all success", | ||
name: "All success", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto here and below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
fields: fields{ | ||
cacheType: "MOCK_CACHE_TYPE", | ||
address: "MOCK_ADDRESS", | ||
|
@@ -133,7 +133,7 @@ func TestCacheEnvs_KeyExpirationTime(t *testing.T) { | |
want time.Duration | ||
}{ | ||
{ | ||
name: "all success", | ||
name: "All success", | ||
fields: fields{ | ||
cacheType: "MOCK_CACHE_TYPE", | ||
address: "MOCK_ADDRESS", | ||
|
@@ -168,7 +168,7 @@ func TestApplicationEnvs_WorkingDir(t *testing.T) { | |
want string | ||
}{ | ||
{ | ||
name: "all success", | ||
name: "All success", | ||
fields: fields{ | ||
workingDir: "MOCK_WORKING_DIR", | ||
cacheEnvs: &CacheEnvs{}, | ||
|
@@ -203,7 +203,7 @@ func TestApplicationEnvs_CacheEnvs(t *testing.T) { | |
want *CacheEnvs | ||
}{ | ||
{ | ||
name: "all success", | ||
name: "All success", | ||
fields: fields{ | ||
workingDir: "MOCK_WORKING_DIR", | ||
cacheEnvs: &CacheEnvs{}, | ||
|
@@ -238,7 +238,7 @@ func TestApplicationEnvs_PipelineExecuteTimeout(t *testing.T) { | |
want time.Duration | ||
}{ | ||
{ | ||
name: "all success", | ||
name: "All success", | ||
fields: fields{ | ||
workingDir: "MOCK_WORKING_DIR", | ||
cacheEnvs: &CacheEnvs{}, | ||
|
@@ -277,7 +277,7 @@ func TestApplicationEnvs_LaunchSite(t *testing.T) { | |
{ | ||
// Test case with calling LaunchSite method. | ||
// As a result, want to receive an expected launch site. | ||
name: "get launch site", | ||
name: "Get launch site", | ||
fields: fields{ | ||
workingDir: "", | ||
cacheEnvs: &CacheEnvs{}, | ||
|
@@ -318,7 +318,7 @@ func TestApplicationEnvs_GoogleProjectId(t *testing.T) { | |
{ | ||
// Test case with calling GoogleProjectId method. | ||
// As a result, want to receive an expected project id. | ||
name: "get google project id", | ||
name: "Get google project id", | ||
fields: fields{ | ||
workingDir: "", | ||
cacheEnvs: &CacheEnvs{}, | ||
|
@@ -358,7 +358,7 @@ func TestApplicationEnvs_PipelinesFolder(t *testing.T) { | |
{ | ||
// Test case with calling PipelinesFolder method. | ||
// As a result, want to receive an expected name of pipelines folder. | ||
name: "get google project id", | ||
name: "Get google project id", | ||
fields: fields{ | ||
workingDir: "", | ||
cacheEnvs: &CacheEnvs{}, | ||
|
@@ -382,3 +382,39 @@ func TestApplicationEnvs_PipelinesFolder(t *testing.T) { | |
}) | ||
} | ||
} | ||
|
||
func TestNetworkEnvs_Protocol(t *testing.T) { | ||
protocol := "HTTP" | ||
type fields struct { | ||
ip string | ||
port int | ||
protocol string | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
want string | ||
}{ | ||
{ | ||
name: "All success", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
fields: fields{ | ||
ip: "", | ||
port: 0, | ||
protocol: protocol, | ||
}, | ||
want: protocol, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
serverEnvs := &NetworkEnvs{ | ||
ip: tt.fields.ip, | ||
port: tt.fields.port, | ||
protocol: tt.fields.protocol, | ||
} | ||
if got := serverEnvs.Protocol(); got != tt.want { | ||
t.Errorf("Protocol() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have more descriptive name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done