Michael Schurter
812f1679e2
Merge pull request #5352 from hashicorp/b-leaked-logmon
...
logmon fixes
2019-02-26 08:35:46 -08:00
Michael Schurter
e39a10a1f4
tests: move unix-specific test to its own file
...
Other logmon tests should be portable.
2019-02-26 07:56:44 -08:00
Michael Schurter
3b2a592e93
client: restart task on logmon failures
...
This code chooses to be conservative as opposed to optimal: when failing
to reattach to logmon simply return a recoverable error instead of
immediately trying to restart logmon.
The recoverable error will cause the task's restart policy to be
applied and a new logmon will be launched upon restart.
Trying to do the optimal approach of simply starting a new logmon
requires error string comparison and should be tested against a task
actively logging to assert the behavior (are writes blocked? dropped?).
2019-02-25 15:42:45 -08:00
Michael Schurter
8830b00866
client: test logmon_hook
2019-02-23 15:36:48 -08:00
Preetha Appan
43679f4ce1
More alloc runner tests ported from 0.8.7
2019-02-22 17:58:06 -06:00
Mahmood Ali
32551fb0e5
emit TaskRestartSignal event on vault restart
...
When Vault token expires and task is restarted, emit `TaskRestartSignal`
similar to v0.8.7
2019-02-22 15:56:14 -05:00
Mahmood Ali
8cb4bbcc08
address review comments
2019-02-22 15:56:14 -05:00
Mahmood Ali
216eaa4843
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
8e9e732319
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
33122ca7c0
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
0128b0ce7a
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
cfb80583af
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
Mahmood Ali
1b14214a88
tests: port TestAllocRunner_RetryArtifact
...
Port TestAllocRunner_RetryArtifact from https://github.com/hashicorp/nomad/blob/v0.8.7/client/alloc_runner_test.go#L610-L672
I changed the test name because it doesn't actually test that artifact
hooks is retried
2019-02-22 15:50:39 -05:00
Mahmood Ali
c827e6e05a
tests: port TestAllocRunner_MoveAllocDir test
2019-02-22 15:50:39 -05:00
Michael Schurter
a2e3ea6dc9
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
01cabdff88
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
e3f321cd27
test: port TestTaskRunner_RestartSignalTask_NotRunning from 0.8
2019-02-21 15:30:49 -08:00
Michael Schurter
f3aa945a00
test: port TestTaskRunner_DriverNetwork from 0.8
2019-02-21 15:30:49 -08:00
Michael Schurter
518405ac33
Merge pull request #5322 from hashicorp/b-artifact-retries
...
Fix regression by restarting on artifact download errors
2019-02-21 15:28:51 -08:00
Michael Schurter
2553800eb8
tests: port TestAllocRunner_Destroy from 0.8
...
Also add destroy(ar) helper to fix a bunch of shutdown races in AR
tests.
2019-02-20 12:35:09 -08:00
Michael Schurter
6580ed668e
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
908bfab4c2
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
79ccf00b72
tests: add new task runner test helper
...
Adds a new helper and removes a duplicated test.
2019-02-20 07:21:27 -08:00
Michael Schurter
159042a1a3
client: fix setting alloc unhealthy at deadline
...
During the 0.9 client refactor the code to fail a deployment when the
deadline was reached was broken. This restores and tests that behavior.
2019-02-19 07:44:14 -08:00
Mahmood Ali
87be233aca
test: improve readability of duration
...
Co-Authored-By: schmichael <michael.schurter@gmail.com>
2019-02-14 08:12:06 -08:00
Mahmood Ali
16d3414842
test: improve failure message
...
Co-Authored-By: schmichael <michael.schurter@gmail.com>
2019-02-14 08:11:37 -08:00
Michael Schurter
4814f0fb0b
tests: port TestTaskRunner_Download_List from 0.8
2019-02-12 15:48:04 -08:00
Michael Schurter
a152e3ef17
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
4ad879e75e
tests: port TaskRunner_DeriveToken tests from 0.8
2019-02-12 15:36:02 -08:00
Michael Schurter
6743ed9fdc
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
6c0cc65b2e
simplify hcl2 parsing helper
...
No need to pass in the entire eval context
2019-02-04 11:07:57 -08:00
Alex Dadgar
5062c54874
Fix usage of fsi variable
2019-01-29 14:07:55 -08:00
Alex Dadgar
6f418ebaf0
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
5da21635fb
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
d6412fd8e7
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
a36c4320ff
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
13f061a83f
Merge pull request #5196 from hashicorp/f-plugin-utils
...
Make plugins/shared external and make pluginutls/
2019-01-23 06:59:32 -08:00
Preetha
05bf183ba3
Merge pull request #5225 from hashicorp/b-notaskevent-terminalallocs
...
Don't emit task events after alloc is in a terminal DesiredState
2019-01-23 08:54:10 -06:00
Michael Schurter
32daa7b47b
goimports until make check is happy
2019-01-23 06:27:14 -08:00
Nick Ethier
bcc3935228
tr: use context in as select statement
2019-01-22 20:11:39 -05:00
Michael Schurter
be0bab7c3f
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
2ca0e97361
Split hclspec
2019-01-22 15:43:34 -08:00
Alex Dadgar
5ca6dd7988
move hclutils
2019-01-22 15:43:34 -08:00
Alex Dadgar
72a5691897
Driver tests do not use hcl2/hcl, hclspec, or hclutils
2019-01-22 15:43:34 -08:00
Preetha Appan
38422642cb
Use DesiredState to determine whether to stop sending task events
2019-01-22 16:43:32 -06:00
Preetha Appan
862c9b7de5
dont emit events for terminal allocs
2019-01-22 16:26:33 -06:00
Michael Schurter
1fa376cac6
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
8ced0adb67
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
1719752a9d
test: port RestartTask from 0.8
2019-01-22 08:08:08 -08:00
Michael Schurter
9edff19625
test: port SignalFailure test from 0.8
...
Also fix signal error handling in mock_driver.
2019-01-22 08:08:08 -08:00