mattermost-community / mattermost-plugin-solar-lottery

A tool somewhat similar to pager duty, allows to have rotations with magic "solar lottery" scheduling, or overrides.
Apache License 2.0
4 stars 10 forks source link

Added back shifts, autopilot #27

Closed levb closed 4 years ago

levb commented 4 years ago

Tests:

Also fixes https://github.com/mattermost/mattermost-plugin-solar-lottery/issues/12 - a seed is now explicitly set on rotation at creation and can be specified.

hanzei commented 4 years ago

I'm unsure if it's related to this PR, but running /lotto rotation param shift ICE --period weekly --duration 30m does cause a panic:

DEBU[2020-04-17T11:11:58.0105972+02:00] panic: runtime error: invalid memory address or nil pointer dereference  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.010636+02:00] [signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0xa15296]  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0106416+02:00]                                               caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.010646+02:00] goroutine 25 [running]:                       caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0106792+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/sl.(*User).Markdown(0x0, 0xc000198868, 0x3)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0106854+02:00]     /home/sumacheb/src/mattermost/plugins/solar-lottery/server/sl/user.go:61 +0x26  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0106914+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/sl.(*sl).UpdateRotation(0xc0000b6cd0, 0xc0000fda9c, 0x3, 0xc00000f220, 0x0, 0x0, 0x1b)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.010697+02:00]  /home/sumacheb/src/mattermost/plugins/solar-lottery/server/sl/sl_rotation.go:161 +0x1bd  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.010703+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/command.(*Command).rotationParamShift(0xc00037e5a0, 0xc0000bb7e0, 0x5, 0x5, 0x3, 0x3, 0xc0003917c0, 0x1b)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107079+02:00]     /home/sumacheb/src/mattermost/plugins/solar-lottery/server/command/rotation_param.go:93 +0x162  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107145+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/command.(*Command).handleCommand(0xc00037e5a0, 0xc0003665c0, 0xc0000bb7d0, 0x6, 0x6, 0xc0003917a0, 0x0, 0xb70000c0003665e0, 0xc000090e00)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107195+02:00]     /home/sumacheb/src/mattermost/plugins/solar-lottery/server/command/command.go:197 +0x207  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107243+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/command.(*Command).rotationParam(0xc00037e5a0, 0xc0000bb7d0, 0x6, 0x6, 0x3, 0x3, 0xc0003917a0, 0x15)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107296+02:00]     /home/sumacheb/src/mattermost/plugins/solar-lottery/server/command/rotation_param.go:20 +0x36f  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.010737+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/command.(*Command).handleCommand(0xc00037e5a0, 0xc000366828, 0xc0000bb7c0, 0x7, 0x7, 0x0, 0xf, 0xc000393da0, 0xc000366818)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107453+02:00]     /home/sumacheb/src/mattermost/plugins/solar-lottery/server/command/command.go:197 +0x207  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107517+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/command.(*Command).rotation(0xc00037e5a0, 0xc0000bb7c0, 0x7, 0x7, 0x3, 0x3, 0xc000393da0, 0xf)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.010759+02:00]  /home/sumacheb/src/mattermost/plugins/solar-lottery/server/command/rotation.go:19 +0x49d  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107644+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/command.(*Command).handleCommand(0xc00037e5a0, 0xc00038dc50, 0xc0000bb7b0, 0x8, 0x8, 0x8, 0x0, 0x0, 0xc0000b6cd0)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107744+02:00]     /home/sumacheb/src/mattermost/plugins/solar-lottery/server/command/command.go:197 +0x207  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.010782+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/command.(*Command).Handle(0xc00037e5a0, 0xc0000d4960, 0x49, 0x0, 0x0)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107865+02:00]     /home/sumacheb/src/mattermost/plugins/solar-lottery/server/command/command.go:164 +0x138  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0107934+02:00] github.com/mattermost/mattermost-plugin-solar-lottery/server/plugin.(*Plugin).ExecuteCommand(0xc00032e000, 0xc00037e540, 0xc0003b8240, 0x7f07427a53f0, 0xc00032e000)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108+02:00]    /home/sumacheb/src/mattermost/plugins/solar-lottery/server/plugin/plugin.go:96 +0x152  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108042+02:00] github.com/mattermost/mattermost-server/v5/plugin.(*hooksRPCServer).ExecuteCommand(0xc000214660, 0xc0003b6cb0, 0xc0003b7050, 0x0, 0x0)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.01081+02:00]   /home/sumacheb/go/pkg/mod/github.com/mattermost/mattermost-server/v5@v5.18.1/plugin/client_rpc_generated.go:114 +0x78  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108166+02:00] reflect.Value.call(0xc00009f500, 0xc0000ac278, 0x13, 0xbd5e5f, 0x4, 0xc000366f08, 0x3, 0x3, 0xa92c20, 0xc00030bda0, ...)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108232+02:00]     /usr/lib/go/src/reflect/value.go:460 +0x8ab  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108654+02:00] reflect.Value.Call(0xc00009f500, 0xc0000ac278, 0x13, 0xc000234708, 0x3, 0x3, 0xc0002346c0, 0x1, 0x0)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108724+02:00]     /usr/lib/go/src/reflect/value.go:321 +0xb4   caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108793+02:00] net/rpc.(*service).call(0xc0000a7b00, 0xc0000b6910, 0xc0000ab1c0, 0xc0000ab1d0, 0xc0000b2880, 0xc0000a92c0, 0xa83ea0, 0xc0003b6cb0, 0x16, 0xa83ee0, ...)  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108898+02:00]     /usr/lib/go/src/net/rpc/server.go:377 +0x17f  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0108984+02:00] created by net/rpc.(*Server).ServeCodec       caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery
DEBU[2020-04-17T11:11:58.0109053+02:00]     /usr/lib/go/src/net/rpc/server.go:474 +0x42b  caller="plugin/hclog_adapter.go:53" plugin_id=com.mattermost.solar-lottery

@levb Please let me know if I open a different issue for this.

codecov-io commented 4 years ago

Codecov Report

Merging #27 into master will increase coverage by 1.77%. The diff coverage is 39.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
+ Coverage   25.25%   27.02%   +1.77%     
==========================================
  Files          82       81       -1     
  Lines        2938     3289     +351     
==========================================
+ Hits          742      889     +147     
- Misses       2104     2298     +194     
- Partials       92      102      +10     
Impacted Files Coverage Δ
server/command/command.go 21.27% <0.00%> (-35.15%) :arrow_down:
server/command/info.go 0.00% <ø> (ø)
server/command/rotation_list.go 33.33% <0.00%> (ø)
server/sl/api_autopilot.go 0.00% <0.00%> (ø)
server/sl/api_task_assign.go 0.00% <0.00%> (ø)
server/sl/api_task_create.go 0.00% <0.00%> (ø)
server/sl/api_task_fill.go 0.00% <0.00%> (ø)
server/sl/api_task_transition.go 0.00% <0.00%> (ø)
server/sl/api_task_unassign.go 0.00% <0.00%> (ø)
server/sl/api_user_add_to_calendar.go 0.00% <0.00%> (ø)
... and 60 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3efdb6a...300e19f. Read the comment docs.

levb commented 4 years ago

(comment to self) There's still some timezone discrepancies in the tests, coverage is running in GMT, unit tests in PDT?

task_fill_test.go:37: 
                Error Trace:    task_fill_test.go:37
                Error:          Not equal: 
                                expected: "2033-01-01T00:00:00-08:00"
                                actual  : "2033-01-01T08:00:00Z"
levb commented 4 years ago

@hanzei @iomodo I (somewhat) addressed Ben's concern about the lack of help/docs.

In general, I feel like there will be another round of polishing the CLI, especially when the HTTP APIs are added and to support the upcoming autocomplete - maybe collect all comments and implement them later? For now focus on usability issues that'd prevent community deployment (I expect that all initial users will need to be plugin admins, and all functionality protected for now)

levb commented 4 years ago

@DHaussermann this was FYI mostly, I know you don't have the cycles to test this pre-alpha PR. Going to merge once the tests pass.