Mahmood Ali
8b7f66499f
address review comments
2019-02-22 15:56:14 -05:00
Mahmood Ali
d80774fde0
tests: port TestTaskRunner_VaultManager_Signal
...
From https://github.com/hashicorp/nomad/blob/v0.8.7/client/task_runner_test.go#L1427
2019-02-22 15:53:04 -05:00
Mahmood Ali
b8c74ff6ca
tests: port TestTaskRunner_VaultManager_Restart
...
From https://github.com/hashicorp/nomad/blob/v0.8.7/client/task_runner_test.go#L1352
2019-02-22 15:53:04 -05:00
Mahmood Ali
ce04bb7440
tests: port TestTaskRunner_UnregisterConsul_Retries
...
From https://github.com/hashicorp/nomad/blob/v0.8.7/client/task_runner_test.go#L620
2019-02-22 15:53:04 -05:00
Mahmood Ali
d6a5a1c5a5
tests: port TestTaskRunner_Template_NewVaultToken
...
From https://github.com/hashicorp/nomad/blob/v0.8.7/client/task_runner_test.go#L1275
2019-02-22 15:53:04 -05:00
Mahmood Ali
90ca1ab5a3
tests: port TestTaskRunner_Template_Artifact
...
From https://github.com/hashicorp/nomad/blob/v0.8.7/client/task_runner_test.go#L1195
2019-02-22 15:52:59 -05:00
Michael Schurter
55cbbded6c
logmon: fix reattach configuration
...
There were multiple bugs here:
1. Reattach unmarshalling always returned an error because you can't
unmarshal into a nil pointer.
2. The hook data wasn't being saved because it was put on the request
struct, not the response struct.
3. The plugin configuration should only have reattach *or* a command
set. Not both.
4. Setting Done=true meant the hook was never re-run on agent restart so
reattaching was never attempted.
2019-02-21 15:32:18 -08:00
Michael Schurter
cf66e25e57
client: restart on recoverable StartTask errors
...
Fixes restarting on recoverable errors from StartTask.
Ports TestTaskRunner_Run_RecoverableStartError from 0.8 which discovered
the bug.
2019-02-21 15:30:49 -08:00
Michael Schurter
414532adab
test: port TestTaskRunner_RestartSignalTask_NotRunning from 0.8
2019-02-21 15:30:49 -08:00
Michael Schurter
d4a17ae71f
test: port TestTaskRunner_DriverNetwork from 0.8
2019-02-21 15:30:49 -08:00
Michael Schurter
1acd4ca744
client: don't redownload completed artifacts on retries
...
Track the download status of each artifact independently so that if only
one of many artifacts fails to download, completed artifacts aren't
downloaded again.
2019-02-20 08:45:12 -08:00
Michael Schurter
c51a54cfee
client: artifact errors are retry-able
...
0.9.0beta2 contains a regression where artifact download errors would
not cause a task restart and instead immediately fail the task.
This restores the pre-0.9 behavior of retrying all artifact errors and
adds missing tests.
2019-02-20 07:21:27 -08:00
Michael Schurter
83979252cd
tests: add new task runner test helper
...
Adds a new helper and removes a duplicated test.
2019-02-20 07:21:27 -08:00
Mahmood Ali
eb8b19ec82
test: improve readability of duration
...
Co-Authored-By: schmichael <michael.schurter@gmail.com >
2019-02-14 08:12:06 -08:00
Mahmood Ali
a96cc97389
test: improve failure message
...
Co-Authored-By: schmichael <michael.schurter@gmail.com >
2019-02-14 08:11:37 -08:00
Michael Schurter
fa9537f6e9
tests: port TestTaskRunner_Download_List from 0.8
2019-02-12 15:48:04 -08:00
Michael Schurter
cfbe7520e8
consul: fix task deregistration hook
...
Broke ShutdownDelay but the test was timing dependent so it just
appeared flaky. Made the test slower so that it should never incorrectly
pass.
2019-02-12 15:36:02 -08:00
Michael Schurter
f2506e4d29
tests: port TaskRunner_DeriveToken tests from 0.8
2019-02-12 15:36:02 -08:00
Michael Schurter
b41308f16a
tests: port TestTaskRunner_BlockForVault from 0.8
...
Also fix race conditions in the mock vault client.
2019-02-12 13:46:09 -08:00
Michael Schurter
1d17fbc681
simplify hcl2 parsing helper
...
No need to pass in the entire eval context
2019-02-04 11:07:57 -08:00
Alex Dadgar
fe6d7df6c4
Fix usage of fsi variable
2019-01-29 14:07:55 -08:00
Alex Dadgar
97e3603043
Always populate task dir environment variables
...
Fixes an issue where if a task was restarted after restating the client,
the task dir environment variables would not be populated. This PR fixes
this for both upgrades from 0.8.X and for normal 0.9 restarts.
2019-01-29 13:17:10 -08:00
Alex Dadgar
22a13de279
Fix env templates having interpolated destinations
...
Fixes an issue where env templates that had interpolated destinations
would not work.
Fixes https://github.com/hashicorp/nomad/issues/5250
2019-01-28 10:28:53 -08:00
Alex Dadgar
d28bf3231e
Fix double restart counting for templates
...
This PR fixes an issue where template restarts would count twice since
it was emitting a restarting event.
2019-01-25 15:38:13 -08:00
Nick Ethier
410bb28420
Merge pull request #5227 from hashicorp/b-client-highcpu-usage
...
Fix bug related to high cpu usage
2019-01-23 14:27:51 -05:00
Michael Schurter
158c74887e
goimports until make check is happy
2019-01-23 06:27:14 -08:00
Nick Ethier
f51b7f9942
tr: use context in as select statement
2019-01-22 20:11:39 -05:00
Michael Schurter
0d61ff0fb9
move pluginutils -> helper/pluginutils
...
I wanted a different color bikeshed, so I get to paint it
2019-01-22 15:50:08 -08:00
Alex Dadgar
72f8851254
Split hclspec
2019-01-22 15:43:34 -08:00
Alex Dadgar
8be7057177
move hclutils
2019-01-22 15:43:34 -08:00
Alex Dadgar
e46d67a889
Driver tests do not use hcl2/hcl, hclspec, or hclutils
2019-01-22 15:43:34 -08:00
Michael Schurter
7c45733ba4
Merge pull request #5211 from hashicorp/test-porting-08
...
Port some 0.8 TaskRunner tests
2019-01-22 14:05:53 -08:00
Michael Schurter
06119e2505
test: port TestTaskRunner_CheckWatcher_Restart
...
Added ability to adjust the number of events the TaskRunner keeps as
there's no way to observe all events otherwise.
Task events differ slightly from 0.8 because 0.9 emits Terminated every
time a task exits instead of only when it exits on its own (not due to
restart or kill).
0.9 does not emit Killing/Killed for restarts like 0.8 which seems fine
as `Restart Signaled/Terminated/Restarting` is more descriptive.
Original v0.8 events emitted:
```
expected := []string{
"Received",
"Task Setup",
"Started",
"Restart Signaled",
"Killing",
"Killed",
"Restarting",
"Started",
"Restart Signaled",
"Killing",
"Killed",
"Restarting",
"Started",
"Restart Signaled",
"Killing",
"Killed",
"Not Restarting",
}
```
2019-01-22 09:46:46 -08:00
Michael Schurter
81334cd3a1
test: port RestartTask from 0.8
2019-01-22 08:08:08 -08:00
Michael Schurter
418d360d19
test: port SignalFailure test from 0.8
...
Also fix signal error handling in mock_driver.
2019-01-22 08:08:08 -08:00
Preetha Appan
a1cc48f78d
Rename TaskKillRequest/Response to TaskPreKillRequest/Response
2019-01-22 09:54:02 -06:00
Preetha Appan
6f3e4e72b9
Fix log comments
2019-01-22 09:45:58 -06:00
Preetha Appan
c3f044291d
Rename TaskKillHook to TaskPreKillHook to more closely match usage
...
Also added/fixed comments
2019-01-22 09:41:56 -06:00
Michael Schurter
77c01c6283
Fix comment
...
Co-Authored-By: preetapan <preetha@hashicorp.com >
2019-01-22 09:41:21 -06:00
Preetha Appan
bf9a2168e7
Rename TaskKillHook to TaskPreKillHook to more closely match usage
...
Also added/fixed comments
2019-01-22 09:41:21 -06:00
Mahmood Ali
9f7619344e
Merge pull request #5190 from hashicorp/f-memory-usage
...
Track Basic Memory Usage as reported by cgroups
2019-01-18 16:46:02 -05:00
Chris Baker
b43f803d36
set TaskGroupName in task_runner
2019-01-18 20:25:11 +00:00
Chris Baker
d2f3dd7530
documenting test for task runner failure to set TaskGroupName
2019-01-18 20:00:49 +00:00
Michael Schurter
4e4ecc949f
Merge pull request #5203 from hashicorp/b-terminated
...
client: restore Terminated event on every exit
2019-01-18 08:54:15 -08:00
Preetha Appan
eb7663697b
Fix one more place that should be using taskResources
...
taskResources handles new resource fields in a backwards compatible way
2019-01-17 15:52:51 -06:00
Michael Schurter
64e531e7bb
client: restore Terminated event on every exit
...
v0.9.0-dev started emitting a Terminated event every time a task process
exited. While this wasn't true in previous versions, it's a useful task
event because it's the only place for job operators to view the task's
exit code.
This behavior is asserted in the e2e/taskevents tests.
2019-01-17 10:02:25 -08:00
Danielle Tomlinson
435a8bae96
Merge pull request #5193 from hashicorp/dani/logmon-reattach
...
logmon: Reattach to existing loggers
2019-01-16 17:34:13 +01:00
Danielle Tomlinson
828d5f5a53
logmon: Reattach to existing loggers
...
This commit prevents us from creating duplicate logmon hooks when
restoring allocations by persisting the logmon reattach config using
HookData.
2019-01-16 14:56:10 +01:00
Michael Schurter
152ba08207
test: porting TestTaskRunner_SimpleRun_Dispatch
...
Porting test from 0.8 to 0.9.
2019-01-15 15:22:13 -08:00
Michael Schurter
3a491ab2b4
Merge pull request #5187 from hashicorp/test-consul
...
Port a bunch of pre-0.9 Consul tests to 0.9
2019-01-15 07:41:50 -08:00