@@ -20,12 +20,12 @@ func TestDeploy_basic(t *testing.T) {
2020 })
2121}
2222
23- func TestDeploy_failure (t * testing.T ) {
23+ func TestDeploy_driverError (t * testing.T ) {
2424 acctest .Test (t , acctest.TestCase {
2525 Steps : []acctest.TestStep {
2626 {
2727 Runner : acctest.DeployTestStepRunner {
28- FixtureName : "deploy_failure .nomad" ,
28+ FixtureName : "deploy_driver_error .nomad" ,
2929 },
3030 ExpectErr : true ,
3131 CheckErr : func (err error ) bool {
@@ -41,3 +41,96 @@ func TestDeploy_failure(t *testing.T) {
4141 CleanupFunc : acctest .CleanupPurgeJob ,
4242 })
4343}
44+
45+ func TestDeploy_allocError (t * testing.T ) {
46+ acctest .Test (t , acctest.TestCase {
47+ Steps : []acctest.TestStep {
48+ {
49+ Runner : acctest.DeployTestStepRunner {
50+ FixtureName : "deploy_alloc_error.nomad" ,
51+ },
52+ ExpectErr : true ,
53+ CheckErr : func (err error ) bool {
54+ // this is a bit pointless without the error bubbled up from levant
55+ return true
56+ },
57+ },
58+ {
59+ // allows us to check a job was registered and previous step error wasn't a parse failure etc.
60+ Check : acctest .CheckDeploymentStatus ("failed" ),
61+ },
62+ },
63+ CleanupFunc : acctest .CleanupPurgeJob ,
64+ })
65+ }
66+
67+ func TestDeploy_count (t * testing.T ) {
68+ acctest .Test (t , acctest.TestCase {
69+ Steps : []acctest.TestStep {
70+ {
71+ Runner : acctest.DeployTestStepRunner {
72+ FixtureName : "deploy_count.nomad" ,
73+ Vars : map [string ]string {
74+ "count" : "3" ,
75+ },
76+ },
77+ Check : acctest .CheckDeploymentStatus ("successful" ),
78+ },
79+ {
80+ Runner : acctest.DeployTestStepRunner {
81+ FixtureName : "deploy_count.nomad" ,
82+ Vars : map [string ]string {
83+ "count" : "1" ,
84+ },
85+ },
86+ Check : acctest .CheckDeploymentStatus ("successful" ),
87+ },
88+ {
89+ // expect levant to read counts from the api
90+ Check : acctest .CheckTaskGroupCount ("test" , 3 ),
91+ },
92+ {
93+ Runner : acctest.DeployTestStepRunner {
94+ FixtureName : "deploy_count.nomad" ,
95+ Vars : map [string ]string {
96+ "count" : "1" ,
97+ },
98+ ForceCount : true ,
99+ },
100+ Check : acctest .CheckDeploymentStatus ("successful" ),
101+ },
102+ {
103+ Check : acctest .CheckTaskGroupCount ("test" , 1 ),
104+ },
105+ },
106+ CleanupFunc : acctest .CleanupPurgeJob ,
107+ })
108+ }
109+
110+ func TestDeploy_canary (t * testing.T ) {
111+ acctest .Test (t , acctest.TestCase {
112+ Steps : []acctest.TestStep {
113+ {
114+ Runner : acctest.DeployTestStepRunner {
115+ FixtureName : "deploy_canary.nomad" ,
116+ Canary : 10 ,
117+ Vars : map [string ]string {
118+ "env_version" : "1" ,
119+ },
120+ },
121+ Check : acctest .CheckDeploymentStatus ("successful" ),
122+ },
123+ {
124+ Runner : acctest.DeployTestStepRunner {
125+ FixtureName : "deploy_canary.nomad" ,
126+ Canary : 10 ,
127+ Vars : map [string ]string {
128+ "env_version" : "2" ,
129+ },
130+ },
131+ Check : acctest .CheckDeploymentStatus ("successful" ),
132+ },
133+ },
134+ CleanupFunc : acctest .CleanupPurgeJob ,
135+ })
136+ }
0 commit comments