| 2915 | } |
| 2916 | |
| 2917 | func TestForce(t *testing.T) { |
| 2918 | t.Parallel() |
| 2919 | |
| 2920 | tests := []struct { |
| 2921 | name string |
| 2922 | env map[string]string |
| 2923 | force bool |
| 2924 | forceAll bool |
| 2925 | }{ |
| 2926 | { |
| 2927 | name: "force", |
| 2928 | force: true, |
| 2929 | }, |
| 2930 | { |
| 2931 | name: "force-all", |
| 2932 | forceAll: true, |
| 2933 | }, |
| 2934 | { |
| 2935 | name: "force with gentle force experiment", |
| 2936 | force: true, |
| 2937 | env: map[string]string{ |
| 2938 | "TASK_X_GENTLE_FORCE": "1", |
| 2939 | }, |
| 2940 | }, |
| 2941 | { |
| 2942 | name: "force-all with gentle force experiment", |
| 2943 | forceAll: true, |
| 2944 | env: map[string]string{ |
| 2945 | "TASK_X_GENTLE_FORCE": "1", |
| 2946 | }, |
| 2947 | }, |
| 2948 | } |
| 2949 | for _, tt := range tests { |
| 2950 | t.Run(tt.name, func(t *testing.T) { |
| 2951 | t.Parallel() |
| 2952 | |
| 2953 | var buff bytes.Buffer |
| 2954 | e := task.NewExecutor( |
| 2955 | task.WithDir("testdata/force"), |
| 2956 | task.WithStdout(&buff), |
| 2957 | task.WithStderr(&buff), |
| 2958 | task.WithForce(tt.force), |
| 2959 | task.WithForceAll(tt.forceAll), |
| 2960 | ) |
| 2961 | require.NoError(t, e.Setup()) |
| 2962 | require.NoError(t, e.Run(t.Context(), &task.Call{Task: "task-with-dep"})) |
| 2963 | }) |
| 2964 | } |
| 2965 | } |
| 2966 | |
| 2967 | func TestWildcard(t *testing.T) { |
| 2968 | t.Parallel() |