-
Notifications
You must be signed in to change notification settings - Fork 958
Expand file tree
/
Copy pathresource_github_actions_environment_variable_migration_test.go
More file actions
53 lines (47 loc) · 1.42 KB
/
resource_github_actions_environment_variable_migration_test.go
File metadata and controls
53 lines (47 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package github
// TODO: Enable this test once we have a pattern to create a mock client for the test.
// import (
// "context"
// "reflect"
// "testing"
// )
// func Test_resourceGithubActionsEnvironmentVariableStateUpgradeV0(t *testing.T) {
// t.Parallel()
// for _, d := range []struct {
// testName string
// rawState map[string]any
// want map[string]any
// shouldError bool
// }{
// {
// testName: "migrates v0 to v1",
// rawState: map[string]any{
// "id": "my-repo:my-environment:MY_VARIABLE",
// "repository": "my-repo",
// "environment": "my-environment",
// "variable_name": "MY_VARIABLE",
// "plaintext_value": "my-value",
// },
// want: map[string]any{
// "id": "my-repo:my-environment:MY_VARIABLE",
// "repository": "my-repo",
// "repository_id": 123456,
// "environment": "my-environment",
// "variable_name": "MY_VARIABLE",
// "plaintext_value": "my-value",
// },
// shouldError: false,
// },
// } {
// t.Run(d.testName, func(t *testing.T) {
// t.Parallel()
// got, err := resourceGithubActionsEnvironmentVariableStateUpgradeV0(t.Context(), d.rawState, nil)
// if (err != nil) != d.shouldError {
// t.Fatalf("unexpected error state")
// }
// if !d.shouldError && !reflect.DeepEqual(got, d.want) {
// t.Fatalf("got %+v, want %+v", got, d.want)
// }
// })
// }
// }