Luca Bigliardi
dcfa3cccf0
server side cleanup should no longer be necessary w/ new goirc, removing
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-29 16:18:09 +02:00
Luca Bigliardi
559b817262
Add tests for channel join retry logic
...
Also adopt interface for querying time information, so it can be faked
properly during at test time
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-29 16:06:36 +02:00
Luca Bigliardi
e7d5eefc49
update goirc version, mod tidy
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 23:46:56 +01:00
Luca Bigliardi
4d0f1f26b0
Graceful disconnect upon context cancel
...
Make sure the underlying library context cancellation happens only
after the session has been shutdown.
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 17:29:54 +01:00
Luca Bigliardi
882cecd6a6
simplify half connected test
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 17:27:35 +01:00
Luca Bigliardi
2990b5a309
fix ghost test
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 15:52:48 +01:00
Luca Bigliardi
0ec08d5ea1
stop storing context received from outside
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 12:35:38 +01:00
Luca Bigliardi
e8f5109703
rename test server to avoid bundling with binary
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 02:21:41 +01:00
Luca Bigliardi
0b2fbef1f2
new channel management logic
...
this should handle bans and kicks a bit better
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 00:49:16 +01:00
Luca Bigliardi
c22e7a0c84
stop using multiple channels in basic conn/auth tests
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-27 00:15:35 +01:00
Luca Bigliardi
4e0b0497f4
move channel-specific tests to new management object
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-26 23:52:07 +01:00
Luca Bigliardi
9690575d68
refactor: move test server in separate file
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-26 23:08:07 +01:00
Luca Bigliardi
9cdffc1dba
refactor: separate func for goirc config creation
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-26 23:03:21 +01:00
Luca Bigliardi
7c999191d7
split channel management in separate object
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-26 22:53:46 +01:00
Luca Bigliardi
cba9deb152
refactor: separate func for handlers registration
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-26 12:40:44 +01:00
Luca Bigliardi
cb65b4d28d
Add factory-like interface to generate Delayers
...
Will be used to inject fake delayers in objects created during tests
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-26 12:34:36 +01:00
Luca Bigliardi
bc13e4be9c
Move Delayer/Backoff stub in its own file
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-25 23:28:13 +01:00
Luca Bigliardi
94ccf2ebd7
rename: ctx, stopCtx
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-22 16:00:03 +01:00
Luca Bigliardi
9c53b88cd9
syntax refactor: use shorter object name in methods
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-21 19:48:19 +01:00
Luca Bigliardi
9f86b35aa5
Update go version list used in github workflows
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-03 16:42:20 +01:00
Luca Bigliardi
a1b44d6ba9
Use goirc ConnectContext
...
Use newly added ConnectContext function.
Note: This is using a yet-to-be-released goirc module version obtained
with "go get -u github.com/fluffle/goirc@master"
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-03 16:13:34 +01:00
Luca Bigliardi
4fd4adb893
Update modules info
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-03-03 16:08:33 +01:00
Luca Bigliardi
1eeb4dda9c
Prevent race condition in TestConnectErrorRetry
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-02-24 20:45:52 +01:00
Luca Bigliardi
2471b866f1
Stop sending messages while disconnected
...
Make sure the session is up before consuming alert messages.
Also, split main run loop for readability.
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-02-24 17:17:46 +01:00
Luca Bigliardi
82af7c1f69
Add Context support to Backoff
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-02-24 17:14:40 +01:00
Luca Bigliardi
bde6681de9
Use Context and WaitGroup for routines coordination
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-02-24 15:49:33 +01:00
Luca Bigliardi
b63d4e99a2
fix typo
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2021-02-20 11:17:54 +01:00
Luca Bigliardi
1ef886d2e7
Merge pull request #11 from filippog/alerts-channel
...
Make alert channel size configurable (and bigger)
2020-11-25 17:19:55 +01:00
Filippo Giunchedi
f03c45406c
Make alert channel size configurable (and bigger)
...
Signed-off-by: Filippo Giunchedi <filippo@wikimedia.org>
2020-11-25 16:06:12 +01:00
Luca Bigliardi
60b1c5eb64
Add Path/Query Escape functions
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-11-10 11:01:49 +01:00
Luca Bigliardi
c07a4e5288
deduplicate format test code
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-11-10 10:41:20 +01:00
Luca Bigliardi
aa63009ab4
Support environment variables in the config file
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-11-05 16:44:56 +01:00
Luca Bigliardi
826f088241
Handle IRC server password
...
Introduce optional config parameter 'irc_host_password' to specify the
IRC server password.
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-11-05 11:05:15 +01:00
Luca Bigliardi
91da0c3744
move to github actions
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-11-05 10:16:56 +01:00
Luca Bigliardi
d89858e51c
Merge pull request #10 from filippog/template-functions
...
Introduce template functions
2020-11-05 09:50:55 +01:00
Luca Bigliardi
acb31ccd03
add strings functions test
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-11-05 09:48:02 +01:00
Filippo Giunchedi
1eb6c5e397
format: add string functions
2020-10-28 17:54:30 +01:00
Filippo Giunchedi
767cb9fb8e
Refactor message formatting functionality
2020-10-28 17:54:20 +01:00
Luca Bigliardi
b62dde73d4
Add basic monitoring instrumentation
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-03-05 11:58:39 +00:00
Luca Bigliardi
d51a33f4e7
Update modules
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-03-05 11:57:58 +00:00
Luca Bigliardi
96acecb3a5
Use safe host / channel default
...
Use nonexistent irc server and empty channel list as default config
options to avoid unwanted surprises when testing the bot.
Addresses https://github.com/google/alertmanager-irc-relay/issues/5
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-03-05 09:12:02 +00:00
Luca Bigliardi
c122337b53
Add config option to skip SSL certs checks
...
This addresses https://github.com/google/alertmanager-irc-relay/issues/3
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-03-05 08:49:31 +00:00
Luca Bigliardi
286efdd365
Update modules
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-03-05 08:47:44 +00:00
Luca Bigliardi
26ff8a17be
Merge pull request #2 from gouthamve/send_upstream
...
Minor cleanup
2020-02-01 00:17:44 +00:00
Ben Kochie
7926f9d7c3
Add Go modules vendoring.
...
Signed-off-by: Ben Kochie <superq@gmail.com>
2020-01-30 17:43:17 +01:00
Goutham Veeramachaneni
219d3672b7
Clean up so that lint would pass
...
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2020-01-30 17:38:45 +01:00
Luca Bigliardi
ae6594c606
Add config option to deliver alerts with PRIVMSG
...
Add `use_privmsg` config option to deliver alerts with PRIVMSG instead
of the default NOTICE.
This addresses a use case described in
https://github.com/google/alertmanager-irc-relay/pull/1 .
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-01-25 18:03:13 +00:00
Luca Bigliardi
4e1aeaf931
s/notice/msg/
...
Use a more generic name as there is soon going to be support for PRIVMSG
(see https://github.com/google/alertmanager-irc-relay/pull/1 for
background).
This introduces a backward-incompatible change in the config file for
these two parameters:
- notice_template -> msg_template
- notice_once_per_alert_group -> msg_once_per_alert_group
I am not introducing the new parameters with a deprecation plan since
both parameters are relatively secondary to the core functioning of the
bot (and this is a free time project after all).
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-01-25 16:42:59 +00:00
Luca Bigliardi
581677b635
Update tests to handle new fingerprint field
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2020-01-25 16:16:10 +00:00
Luca Bigliardi
aebe137d2e
Add basic CircleCI config
...
Signed-off-by: Luca Bigliardi <shammash@google.com>
2018-06-07 15:07:38 +01:00