(t *testing.T)
| 186 | } |
| 187 | |
| 188 | func TestServerlessPlatformMatched(t *testing.T) { |
| 189 | type envPlatform struct { |
| 190 | ServerlessPlatformKey string |
| 191 | ServerlessPlatformVal string |
| 192 | } |
| 193 | tests := []struct { |
| 194 | name string |
| 195 | infos map[string]string |
| 196 | envs *envPlatform |
| 197 | wantMatch bool |
| 198 | }{ |
| 199 | { |
| 200 | name: "test_default_platform", |
| 201 | infos: map[string]string{"serverless.fluid.io/platform": "test"}, |
| 202 | envs: &envPlatform{ |
| 203 | ServerlessPlatformKey: "", |
| 204 | ServerlessPlatformVal: "", |
| 205 | }, |
| 206 | wantMatch: false, |
| 207 | }, |
| 208 | { |
| 209 | name: "test_platform_env_set", |
| 210 | infos: map[string]string{"serverless.fluid.io/platform": "test"}, |
| 211 | envs: &envPlatform{ |
| 212 | ServerlessPlatformKey: "serverless.fluid.io/platform", |
| 213 | ServerlessPlatformVal: "test", |
| 214 | }, |
| 215 | wantMatch: true, |
| 216 | }, |
| 217 | } |
| 218 | for _, tt := range tests { |
| 219 | t.Run(tt.name, func(t *testing.T) { |
| 220 | if tt.envs != nil { |
| 221 | DeprecatedServerlessPlatformKey = tt.envs.ServerlessPlatformKey |
| 222 | } |
| 223 | if gotMatch := serverlessPlatformMatched(tt.infos); gotMatch != tt.wantMatch { |
| 224 | t.Errorf("ServerlessPlatformMatched() = %v, want %v", gotMatch, tt.wantMatch) |
| 225 | } |
| 226 | }) |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | func TestAppControllerDisabled(t *testing.T) { |
| 231 | tests := []struct { |
nothing calls this directly
no test coverage detected