@@ -2,52 +2,14 @@ package nomad
2
2
3
3
import (
4
4
"fmt"
5
- "github.com/hashicorp/nomad/api"
6
5
"testing"
7
6
7
+ "github.com/hashicorp/nomad/api"
8
+
8
9
"github.com/hashicorp/terraform/helper/resource"
9
10
"github.com/hashicorp/terraform/terraform"
10
11
)
11
12
12
- //func cleanupTestJobAndNamespace(jobID, namespace string) resource.TestCheckFunc {
13
- // return func(*terraform.State) error {
14
- // providerConfig := testProvider.Meta().(ProviderConfig)
15
- // client := providerConfig.client
16
- // _, _, err := client.Jobs().Deregister(jobID, true, &api.WriteOptions{
17
- // Namespace: namespace,
18
- // })
19
- // if err != nil {
20
- // return fmt.Errorf("failed to clean up job %q after test: %s", jobID, err)
21
- // }
22
- // if namespace != "default" && namespace != "" {
23
- // _, err := client.Namespaces().Delete(namespace, nil)
24
- // if err != nil {
25
- // return fmt.Errorf("failed to clean up namespace %q after test: %s", namespace, err)
26
- // }
27
- // }
28
- // return nil
29
- // }
30
- //}
31
- //
32
- //func setupTestJobAndNamespace(job, namespace string) error {
33
- // client := testProvider.Meta().(ProviderConfig).client
34
- // fmt.Println("setupTestJobAndNamespace")
35
- // if namespace != "" && namespace != "default" {
36
- // _, err := client.Namespaces().Register(&api.Namespace{
37
- // Name: namespace,
38
- // }, nil)
39
- // if err != nil {
40
- // return fmt.Errorf("error creating test namespace: %s", err)
41
- // }
42
- // }
43
- // j, _ := client.Jobs().ParseHCL(testJobHCL(job, namespace), false)
44
- // _, _, err := client.Jobs().Register(j, nil)
45
- // if err != nil {
46
- // return fmt.Errorf("error creating test job: %s", err)
47
- // }
48
- // return nil
49
- //}
50
-
51
13
func TestAccDataSourceNomadJob_Basic (t * testing.T ) {
52
14
job := "testjobds"
53
15
resource .Test (t , resource.TestCase {
@@ -69,11 +31,6 @@ func TestAccDataSourceNomadJob_Basic(t *testing.T) {
69
31
"data.nomad_job.test-job" , "namespace" , "default" ),
70
32
),
71
33
},
72
- //{
73
- // Config: testAccCheckDataSourceNomadJobConfigErr,
74
- // Destroy: false,
75
- // ExpectError: regexp.MustCompile(`.*job not found`),
76
- //},
77
34
},
78
35
})
79
36
}
@@ -100,10 +57,6 @@ func TestAccDataSourceNomadJob_Namespaced(t *testing.T) {
100
57
"data.nomad_job.test-job" , "namespace" , ns ),
101
58
),
102
59
},
103
- //{
104
- // Config: testAccCheckDataSourceNomadJobWrongNamespace,
105
- // ExpectError: regexp.MustCompile(`.*job not found`),
106
- //},
107
60
},
108
61
})
109
62
}
0 commit comments