Download this file
| 1 | package console |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "errors" |
| 6 | "testing" |
| 7 | |
| 8 | "github.com/carlosframework/platform/internal/hostops" |
| 9 | ) |
| 10 | |
| 11 | func TestClaimRuntimeFlagOffDoesNotNeedProviders(t *testing.T) { |
| 12 | s := &Server{} |
| 13 | if err := s.ConfigureClaimRuntime(context.Background()); err != nil { |
| 14 | t.Fatal(err) |
| 15 | } |
| 16 | if err := s.RunClaimRecoveryPass(context.Background()); err != nil { |
| 17 | t.Fatal(err) |
| 18 | } |
| 19 | s.StartClaimRecoveryPass(context.Background()) |
| 20 | if s.cfg.HostClaimOps != nil || s.cfg.HostClaimRecovery != nil || s.cfg.ClaimPurge != nil || s.cfg.ClaimPlacement != nil { |
| 21 | t.Fatal("constructed a disabled provider") |
| 22 | } |
| 23 | s.cfg.HostClaim = true |
| 24 | if err := s.ConfigureClaimRuntime(context.Background()); !errors.Is(err, hostops.ErrContract) { |
| 25 | t.Fatalf("enabled without providers: %v", err) |
| 26 | } |
| 27 | } |
| 28 | |