diff --git a/go.mod b/go.mod index 38b2b7cf..693648b5 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ toolchain go1.21.1 require ( emperror.dev/emperror v0.33.0 github.com/alecthomas/kong v0.8.1 - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc github.com/go-chi/chi/v5 v5.0.10 github.com/go-kit/kit v0.13.0 github.com/gorilla/mux v1.8.0 @@ -19,7 +18,6 @@ require ( github.com/satori/go.uuid v1.2.0 github.com/spf13/viper v1.17.0 github.com/stretchr/testify v1.8.4 - github.com/xmidt-org/ancla v0.3.11 github.com/xmidt-org/arrange v0.5.1-0.20230914215531-f02b8651b631 github.com/xmidt-org/bascule v0.11.7 github.com/xmidt-org/candlelight v0.0.19 @@ -41,6 +39,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-kit/log v0.2.1 // indirect @@ -85,7 +84,6 @@ require ( github.com/stretchr/objx v0.5.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/ugorji/go/codec v1.2.11 // indirect - github.com/xmidt-org/argus v0.9.12 // indirect github.com/xmidt-org/chronon v0.1.1 // indirect go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect diff --git a/go.sum b/go.sum index 773977a7..2fe595b9 100644 --- a/go.sum +++ b/go.sum @@ -271,7 +271,6 @@ cloud.google.com/go/filestore v1.5.0/go.mod h1:FqBXDWBp4YLHqRnVGveOkHDf8svj9r5+m cloud.google.com/go/filestore v1.6.0/go.mod h1:di5unNuss/qfZTw2U9nhFqo8/ZDSc466dre85Kydllg= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/firestore v1.6.1/go.mod h1:asNXNOzBdyVQmEU+ggO8UPodTkEVFW5Qx+rwHnAz+EY= -cloud.google.com/go/firestore v1.8.0/go.mod h1:r3KB8cAdRIe8znzoPWLw8S6gpDVd9treohhn8b09424= cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= @@ -626,10 +625,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2 h1:koK7z0nSsRiRiBWwa+E714Puh+DO+ZRdIyAXiXzL+lg= github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/sarama v1.30.0/go.mod h1:zujlQQx1kzHsh4jfV1USnptCQrHAEZ2Hk8fTKCulPVs= github.com/Shopify/sarama v1.37.2/go.mod h1:Nxye/E+YPru//Bpaorfhc3JsSGYwCaDDj+R4bK52U5o= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/Shopify/toxiproxy/v2 v2.1.6-0.20210914104332-15ea381dcdae/go.mod h1:/cvHQkZ1fst0EmZnA5dFtiQdWCNCFYzb+uE2vqVgvx0= github.com/Shopify/toxiproxy/v2 v2.5.0/go.mod h1:yhM2epWtAmel9CB8r2+L+PCmhH6yH2pITaPAo7jxJl0= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= @@ -679,11 +676,8 @@ github.com/aws/aws-sdk-go v1.25.41/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpi github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.31.6/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= -github.com/aws/aws-sdk-go v1.44.176/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go v1.44.228/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go v1.44.317/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= -github.com/aws/aws-sdk-go v1.46.6 h1:6wFnNC9hETIZLMf6SOTN7IcclrOGwp/n9SLp8Pjt6E8= -github.com/aws/aws-sdk-go v1.46.6/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.9.1/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.8.1/go.mod h1:CM+19rL1+4dFWnOQKwDc7H1KwXTz+h61oUSHyhV0b3o= @@ -789,7 +783,6 @@ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3 github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-resiliency v1.3.0/go.mod h1:5yPzW0MIvSe0JDsv0v+DvcjEv2FyD6iZYSs1ZI+iQho= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= @@ -828,7 +821,6 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goblin v0.0.0-20210519012713-85d372ac71e2/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= @@ -881,13 +873,10 @@ github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhO github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.3.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-playground/validator/v10 v10.12.0/go.mod h1:hCAPuzYvKdP33pxWa+2+6AIKXEKqjIUyqsNCtbsSJrA= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= @@ -1082,7 +1071,6 @@ github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT github.com/hashicorp/consul/api v1.7.0/go.mod h1:1NSuaUUkFaJzMasbfq/11wKYWSR67Xn6r2DXKhuDNFg= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= -github.com/hashicorp/consul/api v1.15.3/go.mod h1:/g/qgcoBcEXALCNZgRRisyTW0nY86++L0KbeAMXYCeY= github.com/hashicorp/consul/api v1.18.0/go.mod h1:owRRGJ9M5xReDC5nfT8FTJrNAPbT4NM6p/k+d03q2v4= github.com/hashicorp/consul/api v1.20.0/go.mod h1:nR64eD44KQ59Of/ECwt2vUmIK2DKsDzAwTmwmLl8Wpo= github.com/hashicorp/consul/api v1.24.0/go.mod h1:NZJGRFYruc/80wYowkPFCp1LbGmJC9L8izrwfyVx/Wg= @@ -1091,7 +1079,6 @@ github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= github.com/hashicorp/consul/sdk v0.6.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/consul/sdk v0.11.0/go.mod h1:yPkX5Q6CsxTFMjQQDJwzeNmUUF5NUGGbrDsv9wTb8cw= github.com/hashicorp/consul/sdk v0.13.0/go.mod h1:0hs/l5fOVhJy/VdcoaNqUSi2AUs95eF5WKtv+EYIQqE= github.com/hashicorp/consul/sdk v0.13.1/go.mod h1:SW/mM4LbKfqmMvcFu8v+eiQQ7oitXEFeiBe9StxERb0= github.com/hashicorp/consul/sdk v0.14.1/go.mod h1:vFt03juSzocLRFo59NkeQHHmQa6+g7oU0pfzdI1mUhg= @@ -1108,14 +1095,12 @@ github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9 github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.2.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-memdb v1.0.3/go.mod h1:LWQ8R70vPrS4OEY9k28D2z8/Zzyu34NVzeRibGAzHO0= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= @@ -1157,7 +1142,6 @@ github.com/hashicorp/memberlist v0.1.5/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/memberlist v0.1.6/go.mod h1:5VDNHjqFMgEcclnwmkCnC99IPwxBmIsxwY8qn+Nl0H4= github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/memberlist v0.3.1/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69/go.mod h1:/z+jUGRBlwVpUZfjute9jWaF6/HuhjuFQuL1YXzVD1Q= github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= @@ -1171,7 +1155,6 @@ github.com/hashicorp/serf v0.9.4/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKEN github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= -github.com/hashicorp/serf v0.9.8/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q= github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= @@ -1197,10 +1180,8 @@ github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4= github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= -github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= -github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc= github.com/jcmturner/gokrb5/v8 v8.4.3/go.mod h1:dqRwJGXznQrzw6cWmyo6kH+E7jksEQG/CyVWsJEsJO0= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -1258,7 +1239,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.2.2/go.mod h1:kUaIbLZWttglzwNuG0pgsh5vuV6u2YcGBYz1hIPjtOQ= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= @@ -1277,7 +1257,6 @@ github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn github.com/lestrrat-go/jwx v0.9.2/go.mod h1:iEoxlYfZjvoGpuWwxUz+eR5e6KTJGsaRcy/YNA/UnBk= github.com/lestrrat-go/jwx v1.2.25/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY= github.com/lestrrat-go/jwx/v2 v2.0.5/go.mod h1:Wot5JT7sGDorqS+dBi6Cfu6MzsDZP+sAOnQbOJ8rpIA= -github.com/lestrrat-go/jwx/v2 v2.0.7/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= github.com/lestrrat-go/jwx/v2 v2.0.8/go.mod h1:zLxnyv9rTlEvOUHbc48FAfIL8iYu2hHvIRaTFGc8mT0= github.com/lestrrat-go/jwx/v2 v2.0.16 h1:TuH3dBkYTy2giQg/9D8f20znS3JtMRuQJ372boS3lWk= github.com/lestrrat-go/jwx/v2 v2.0.16/go.mod h1:jBHyESp4e7QxfERM0UKkQ80/94paqNIEcdEfiUYz5zE= @@ -1417,7 +1396,6 @@ github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= -github.com/openzipkin/zipkin-go v0.4.0/go.mod h1:4c3sLeE8xjNqehmF5RpAFLPLJxXscc0R4l6Zg0P1tTQ= github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAyg7Qt6/I9HecM= github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= @@ -1430,7 +1408,6 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= -github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= @@ -1444,7 +1421,6 @@ github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= @@ -1529,7 +1505,6 @@ github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3c github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef h1:NKxTG6GVGbfMXc2mIk+KphcH6hagbVXhcFkbTgYleTI= github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef/go.mod h1:tcaRap0jS3eifrEEllL6ZMd9dg8IlDpi2S1oARrQ+NI= -github.com/rabbitmq/amqp091-go v1.1.0/go.mod h1:ogQDLSOACsLPsIq0NpbtiifNZi2YOz0VTJ0kHRghqbM= github.com/rabbitmq/amqp091-go v1.5.0/go.mod h1:JsV0ofX5f1nwOGafb8L5rBItt9GyhfQfcJj+oyz0dGg= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -1539,7 +1514,6 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= @@ -1556,7 +1530,6 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= -github.com/sagikazarmark/crypt v0.8.0/go.mod h1:TmKwZAo97S4Fy4sfMH/HX/cQP5D+ijra2NyLpNNmttY= github.com/sagikazarmark/crypt v0.9.0/go.mod h1:RnH7sEhxfdnPm1z+XMgSLjWTEIjyK4z2dw6+4vHTMuo= github.com/sagikazarmark/crypt v0.10.0/go.mod h1:gwTNHQVoOS3xp9Xvz5LLR+1AauC5M6880z5NWzdhOyQ= github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= @@ -1622,7 +1595,6 @@ github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfD github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= -github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= @@ -1659,7 +1631,6 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= -github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= @@ -1677,27 +1648,19 @@ github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4d github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.11.0/go.mod h1:f8iq5LtQ/bLxafbdBSLPPNsgaW0l/2fYYEHhAyPlwvo= github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/xhit/go-str2duration v1.2.0/go.mod h1:3cPSlfZlUHVlneIVfePFWcJZsuwf+P1v2SRTV4cUmp4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xmidt-org/ancla v0.3.11 h1:qrfTxuG2wZuOnauMekJERBMLMdbwF9DXrQZ4gjoX5Ys= -github.com/xmidt-org/ancla v0.3.11/go.mod h1:7/2FyLkC3Aus4vu5Se/DTdp/M8bdJCJXlEGs71cP00w= github.com/xmidt-org/argus v0.3.9/go.mod h1:mDFS44R704gl9Fif3gkfAyvnZa53SvMepmXjYWABPvk= github.com/xmidt-org/argus v0.3.10-0.20201105190057-402fede05764/go.mod h1:lnMCVB/i0gOlUOOd2WbzDDgzTEqP5TipzQ8xKIw+N/I= github.com/xmidt-org/argus v0.3.10-0.20201217204602-66f69b12c498/go.mod h1:lnMCVB/i0gOlUOOd2WbzDDgzTEqP5TipzQ8xKIw+N/I= github.com/xmidt-org/argus v0.3.12/go.mod h1:T0oHbqQ1SAjE616Q9f1p+7nsmuvmHNoC0zAIUpUiFuE= github.com/xmidt-org/argus v0.5.0/go.mod h1:8nMg4ywpWCNPgUzwtWhiPAxklrmVsoxwciGJ/OD4FHE= -github.com/xmidt-org/argus v0.9.5/go.mod h1:2G5J88QKgnwrkTf+yc+RAIQQj9wkuF1D2zBuQk6Zeks= github.com/xmidt-org/argus v0.9.10/go.mod h1:FBFhBQ07fquAiDT7mMG+X6h0ycerZQJCpqIlQJ+Kjf8= -github.com/xmidt-org/argus v0.9.12 h1:5u0Itt8FzwBvo/DogYhpLsKzThEg+6aVVdVhc2FQMWw= -github.com/xmidt-org/argus v0.9.12/go.mod h1:sJ/pCNapRY42Et4r0d5lr25228lVVZCXALVliY0aOcM= github.com/xmidt-org/arrange v0.1.9/go.mod h1:PRA8iEZ11L93NsEkDP56x1mZyfDcWxzDULgHj56TaEk= github.com/xmidt-org/arrange v0.3.0/go.mod h1:pCHeb93OFA0QnEJ//Mmly7QqUt7y/w3xllK0VQ3Bigo= github.com/xmidt-org/arrange v0.4.0/go.mod h1:MA1eKUZYxaSMIKJL3D/iJEMQruiefmhq+s5E9J4UJv0= @@ -1707,12 +1670,10 @@ github.com/xmidt-org/bascule v0.8.0/go.mod h1:dPxlbNT3lCwYAtOq2zbzyzTEKgM+azLSbK github.com/xmidt-org/bascule v0.8.1/go.mod h1:dPxlbNT3lCwYAtOq2zbzyzTEKgM+azLSbKKcVmgSHBY= github.com/xmidt-org/bascule v0.9.0/go.mod h1:C64nSBtUTTK/f2/mCvvp/qJhav5raD0T+by68DCp/gU= github.com/xmidt-org/bascule v0.10.1/go.mod h1:unqyDUxjulfGFnx4kYWbonTGkVHGWPUjUrBkUi1sjWw= -github.com/xmidt-org/bascule v0.11.2/go.mod h1:OQ+7pP5xccrTYW+JUCTYXfUWvEy4vBa6ng9ppMGb/1s= github.com/xmidt-org/bascule v0.11.4/go.mod h1:/MKKhwnktnYeQXFChuYqdE81od+BWbdS/qJPJP7APgo= github.com/xmidt-org/bascule v0.11.7 h1:+pasCXM+irFuBB4HgO67xC7VHuygjmlmFjEpJdBGXeQ= github.com/xmidt-org/bascule v0.11.7/go.mod h1:SyAUlH8Y77Iq97u2d4Q7d9ldE7pCqNuQq7bFcl05zwo= github.com/xmidt-org/candlelight v0.0.5/go.mod h1:j9Q2tzrOAywm+JvvVJjlOmlPJvdlRrOyFjLz33SaU1Y= -github.com/xmidt-org/candlelight v0.0.12/go.mod h1:H8cWj+dum/HH5Pxpd2uUv2C0VuDPKZ50nNQ7CRT4iuA= github.com/xmidt-org/candlelight v0.0.13/go.mod h1:FelQ+nb3rRuQx50zvp3hjEm2DBUU1rlT17FWxfeXQd0= github.com/xmidt-org/candlelight v0.0.15/go.mod h1:yYzrElo3KP1BZ5GAPus7PXehhe7SJYwt7JwCb/+BWQ0= github.com/xmidt-org/candlelight v0.0.16/go.mod h1:uKs19MQmcrKxFGJhnkVVpEmFJbav5y3jJs30O7204Vo= @@ -1772,24 +1733,20 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A= -go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= go.etcd.io/etcd/api/v3 v3.5.6/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8= go.etcd.io/etcd/api/v3 v3.5.7/go.mod h1:9qew1gCdDDLu+VwmeG+iFpL+QlpHTo7iubavdVDgCAA= go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k= go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/pkg/v3 v3.5.5/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ= go.etcd.io/etcd/client/pkg/v3 v3.5.6/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ= go.etcd.io/etcd/client/pkg/v3 v3.5.7/go.mod h1:o0Abi1MK86iad3YrWhgUsbGx1pmTS+hrORWc2CamuhY= go.etcd.io/etcd/client/pkg/v3 v3.5.9/go.mod h1:y+CzeSmkMpWN2Jyu1npecjB9BBnABxGM4pN8cGuJeL4= go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.etcd.io/etcd/client/v2 v2.305.4/go.mod h1:Ud+VUwIi9/uQHOMA+4ekToJ12lTxlv0zB/+DHwTGEbU= -go.etcd.io/etcd/client/v2 v2.305.5/go.mod h1:zQjKllfqfBVyVStbt4FaosoX2iYd8fV/GRy/PbowgP4= go.etcd.io/etcd/client/v2 v2.305.6/go.mod h1:BHha8XJGe8vCIBfWBpbBLVZ4QjOIlfoouvOwydu63E0= go.etcd.io/etcd/client/v2 v2.305.7/go.mod h1:GQGT5Z3TBuAQGvgPfhR7VPySu/SudxmEkRq9BgzFU6s= go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY= -go.etcd.io/etcd/client/v3 v3.5.5/go.mod h1:aApjR4WGlSumpnJ2kloS75h6aHUmAyaPLjHMxpc7E7c= go.etcd.io/etcd/client/v3 v3.5.6/go.mod h1:f6GRinRMCsFVv9Ht42EyY7nfsVGwrNO0WEoS2pRKzQk= go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1804,7 +1761,6 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/contrib v0.19.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc= go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.19.0/go.mod h1:ze4w2zyQP+FvZjaahHaUVD7h4razLhDOsZD3qFKXc3c= -go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.37.0/go.mod h1:L2aUfzscu1vQEIoYXNTkCrw1ICYXWcZ+f9DtK17xYwA= go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.38.0/go.mod h1:iUSPEXZM7sckWSTCtzog1lU42Qaiu9U2WY6vdqwFHDI= go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.40.0/go.mod h1:RK3vgddjxVcF1q7IBVppzG6k2cW/NBnZHQ3X4g+EYBQ= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.19.0/go.mod h1:7RDsakVbjb124lYDEjKuHTuzdqf04hLMEvPv/ufmqMs= @@ -1812,16 +1768,12 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.38.0/go.mod h1: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0/go.mod h1:pcQ3MM3SWvrA71U4GDqv9UFDJ3HQsW7y5ZO3tDTlUdI= go.opentelemetry.io/contrib/propagators v0.19.0/go.mod h1:4QOdZClXISU5S43xZxk5tYaWcpb+lehqfKtE6PK6msE= go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg= -go.opentelemetry.io/otel v1.11.0/go.mod h1:H2KtuEphyMvlhZ+F7tg9GRhAOe60moNx61Ex+WmiKkk= -go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel v1.12.0/go.mod h1:geaoz0L0r1BEOR81k7/n9W4TCXYCJ7bPO7K374jQHG0= go.opentelemetry.io/otel v1.13.0/go.mod h1:FH3RtdZCzRkJYFTCsAKDy9l/XYjMdNv6QrkFFB8DvVg= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel/exporters/jaeger v1.11.0/go.mod h1:nRgyJbgJ0hmaUdHwyDpTTfBYz61cTTeeGhVzfQc+FsI= -go.opentelemetry.io/otel/exporters/jaeger v1.11.1/go.mod h1:lRa2w3bQ4R4QN6zYsDgy7tEezgoKEu7Ow2g35Y75+KI= go.opentelemetry.io/otel/exporters/jaeger v1.11.2/go.mod h1:nwcF/DK4Hk0auZ/a5vw20uMsaJSXbzeeimhN5f9d0Lc= go.opentelemetry.io/otel/exporters/jaeger v1.14.0/go.mod h1:4Ay9kk5vELRrbg5z4cpP9EtmQRFap2Wb0woPG4lujZA= go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4= @@ -1841,16 +1793,12 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.14.0/go.mod h go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= go.opentelemetry.io/otel/exporters/stdout v0.19.0/go.mod h1:UI2JnNRaSt9ChIHkk4+uqieH27qKt9isV9e2qRorCtg= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.0/go.mod h1:nMt8nBu01qC+8LfJu4puk/OYHovohkISNuy/MMG8yRk= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.1/go.mod h1:pyHDt0YlyuENkD2VwHsiRDf+5DfI3EH7pfhUYW6sQUE= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0/go.mod h1:oCslUcizYdpKYyS9e8srZEqM6BB8fq41VJBjLAE6z1w= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 h1:Nw7Dv4lwvGrI68+wULbcq7su9K2cebeCUrDjVrUJHxM= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0/go.mod h1:1MsF6Y7gTqosgoZvHlzcaaM8DIMNZgJh87ykokoNH7Y= go.opentelemetry.io/otel/exporters/trace/jaeger v0.19.0/go.mod h1:BliRm9d7rH44N6CzBQ0OPEPfMqSzf4WvFFvyoocOW9Y= go.opentelemetry.io/otel/exporters/trace/zipkin v0.19.0/go.mod h1:ONsRnXqWLUtdSaLOziKSCaw3r20gFBhnXr8rj6L9cZQ= -go.opentelemetry.io/otel/exporters/zipkin v1.11.0/go.mod h1:unWnsLCMYfINP8ue0aXVrB/GYHoXNn/lbTnupvLekGQ= -go.opentelemetry.io/otel/exporters/zipkin v1.11.1/go.mod h1:T4S6aVwIS1+MHA+dJHCcPROtZe6ORwnv5vMKPRapsFw= go.opentelemetry.io/otel/exporters/zipkin v1.11.2/go.mod h1:I60/FdYilVKkuDOzenyp8LqJLryRC/Mr918G5hchvkM= go.opentelemetry.io/otel/exporters/zipkin v1.13.0/go.mod h1:x6S2VkXmdpoYUqQx9FKiMEsndal6xkcwDdV0Oi1RlLM= go.opentelemetry.io/otel/exporters/zipkin v1.14.0/go.mod h1:RcjvOAcvhzcufQP8aHmzRw1gE9g/VEZufDdo2w+s4sk= @@ -1863,8 +1811,6 @@ go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPi go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= go.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA= go.opentelemetry.io/otel/sdk v0.19.0/go.mod h1:ouO7auJYMivDjywCHA6bqTI7jJMVQV1HdKR5CmH8DGo= -go.opentelemetry.io/otel/sdk v1.11.0/go.mod h1:REusa8RsyKaq0OlyangWXaw97t2VogoO4SSEeKkSTAk= -go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOlithYrdktys= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/sdk v1.12.0/go.mod h1:WYcvtgquYvgODEvxOry5owO2y9MyciW7JqMz6cpXShE= go.opentelemetry.io/otel/sdk v1.13.0/go.mod h1:YLKPx5+6Vx/o1TCUYYs+bpymtkmazOMT6zoRrC7AQ7I= @@ -1874,8 +1820,6 @@ go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+Gf go.opentelemetry.io/otel/sdk/export/metric v0.19.0/go.mod h1:exXalzlU6quLTXiv29J+Qpj/toOzL3H5WvpbbjouTBo= go.opentelemetry.io/otel/sdk/metric v0.19.0/go.mod h1:t12+Mqmj64q1vMpxHlCGXGggo0sadYxEG6U+Us/9OA4= go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg= -go.opentelemetry.io/otel/trace v1.11.0/go.mod h1:nyYjis9jy0gytE9LXGU+/m1sHTKbRY0fX0hulNNDP1U= -go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= go.opentelemetry.io/otel/trace v1.12.0/go.mod h1:pHlgBynn6s25qJ2szD+Bv+iwKJttjHSI3lUAyf0GNuQ= go.opentelemetry.io/otel/trace v1.13.0/go.mod h1:muCvmmO9KKpvuXSf3KKAXXB2ygNYHQ+ZfI5X08d3tds= @@ -1965,15 +1909,12 @@ golang.org/x/crypto v0.0.0-20191106202628-ed6320f186d4/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210920023735-84f357641f63/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -1981,7 +1922,6 @@ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.2.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= @@ -2360,7 +2300,6 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220609170525-579cf78fd858/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2653,7 +2592,6 @@ google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614G google.golang.org/genproto v0.0.0-20221205194025-8222ab48f5fc/go.mod h1:1dOng4TWOomJrDGhpXjfCD35wQC6jnC7HpRmOFRqEV0= google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230109162033-3c3c17ce83e6/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230112194545-e10362b5ecf9/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230113154510-dbe35b8444a5/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= diff --git a/mocks_test.go b/mocks_test.go index 46d58aca..1c748818 100644 --- a/mocks_test.go +++ b/mocks_test.go @@ -8,7 +8,6 @@ import ( "github.com/go-kit/kit/metrics" "github.com/stretchr/testify/mock" - "github.com/xmidt-org/ancla" "github.com/xmidt-org/wrp-go/v3" ) @@ -26,9 +25,9 @@ type mockSenderWrapper struct { mock.Mock } -func (m *mockSenderWrapper) Update(list []ancla.InternalWebhook) { - m.Called(list) -} +// func (m *mockSenderWrapper) Update(list []ancla.InternalWebhook) { +// m.Called(list) +// } func (m *mockSenderWrapper) Queue(msg *wrp.Message) { m.Called(msg) diff --git a/outboundSender_test.go b/outboundSender_test.go index 26592535..a45176c0 100644 --- a/outboundSender_test.go +++ b/outboundSender_test.go @@ -1,1004 +1,1003 @@ -// SPDX-FileCopyrightText: 2021 Comcast Cable Communications Management, LLC -// SPDX-License-Identifier: Apache-2.0 +// // SPDX-FileCopyrightText: 2021 Comcast Cable Communications Management, LLC +// // SPDX-License-Identifier: Apache-2.0 package main -import ( - "bytes" - "fmt" - - "github.com/davecgh/go-spew/spew" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/xmidt-org/ancla" - "github.com/xmidt-org/wrp-go/v3" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - - //"github.com/stretchr/testify/mock" - "io" - "net" - "net/http" - "sync/atomic" - "testing" - "time" -) - -// Make a simple RoundTrip implementation that let's me short-circuit the network -type transport struct { - i int32 - fn func(*http.Request, int) (*http.Response, error) -} - -func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { - i := atomic.AddInt32(&t.i, 1) - return t.fn(req, int(i)) -} - -func getNewTestOutputLogger(out io.Writer) *zap.Logger { - var b bytes.Buffer - - return zap.New( - zapcore.NewCore(zapcore.NewJSONEncoder( - zapcore.EncoderConfig{ - MessageKey: "message", - }), zapcore.AddSync(&b), zapcore.ErrorLevel), - ) -} - -func simpleSetup(trans *transport, cutOffPeriod time.Duration, matcher []string) (OutboundSender, error) { - return simpleFactorySetup(trans, cutOffPeriod, matcher).New() -} - -// simpleFactorySetup sets up a outboundSender with metrics. -// -// # Using Caduceus's test suite -// -// If you are testing a new metric it needs to be created in this process below. -// 1. Create a fake, mockMetric i.e fakeEventType := new(mockCounter) -// 2. If your metric type has yet to be included in mockCaduceusMetricRegistry within mocks.go -// add your metric type to mockCaduceusMetricRegistry -// 3. Trigger the On method on that "mockMetric" with various different cases of that metric, -// in both senderWrapper_test.go and outboundSender_test.go -// i.e: -// case 1: On("With", []string{"event", iot} -// case 2: On("With", []string{"event", unknown} -// 4. Mimic the metric behavior using On: -// fakeSlow.On("Add", 1.0).Return() -func simpleFactorySetup(trans *transport, cutOffPeriod time.Duration, matcher []string) *OutboundSenderFactory { - if nil == trans.fn { - trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { - resp = &http.Response{Status: "200 OK", - StatusCode: 200, - } - return - } - } - - w := ancla.InternalWebhook{ - Webhook: ancla.Webhook{ - Until: time.Now().Add(60 * time.Second), - Events: []string{"iot", "test"}, - Config: ancla.DeliveryConfig{ - URL: "http://localhost:9999/foo", - ContentType: wrp.MimeTypeJson, - Secret: "123456", - }, - }, - PartnerIDs: []string{"comcast"}, - } - w.Webhook.Matcher.DeviceID = matcher - - // test dc metric - fakeDC := new(mockCounter) - fakeDC.On("With", []string{"url", w.Webhook.Config.URL, "code", "200", "event", "test"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "200", "event", "iot"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "200", "event", "unknown"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "failure", "event", "iot"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "event", "test"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "event", "iot"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "event", "unknown"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "201"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "202"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "204"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "429", "event", "iot"}).Return(fakeDC). - On("With", []string{"url", w.Webhook.Config.URL, "code", "failure"}).Return(fakeDC) - fakeDC.On("Add", 1.0).Return() - fakeDC.On("Add", 0.0).Return() - - // test slow metric - fakeSlow := new(mockCounter) - fakeSlow.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakeSlow) - fakeSlow.On("Add", 1.0).Return() - - // test dropped metric - fakeDroppedSlow := new(mockCounter) - fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "queue_full"}).Return(fakeDroppedSlow) - fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "cut_off"}).Return(fakeDroppedSlow) - fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "expired"}).Return(fakeDroppedSlow) - fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "expired_before_queueing"}).Return(fakeDroppedSlow) - fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "invalid_config"}).Return(fakeDroppedSlow) - fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "network_err"}).Return(fakeDroppedSlow) - fakeDroppedSlow.On("Add", mock.Anything).Return() - - // IncomingContentType cases - fakeContentType := new(mockCounter) - fakeContentType.On("With", []string{"content_type", "msgpack"}).Return(fakeContentType) - fakeContentType.On("With", []string{"content_type", "json"}).Return(fakeContentType) - fakeContentType.On("With", []string{"content_type", "http"}).Return(fakeContentType) - fakeContentType.On("With", []string{"content_type", "other"}).Return(fakeContentType) - fakeContentType.On("Add", 1.0).Return() - - // QueueDepth case - fakeQdepth := new(mockGauge) - fakeQdepth.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakeQdepth) - fakeQdepth.On("Add", 1.0).Return().On("Add", -1.0).Return() - - // DropsDueToPanic case - fakePanicDrop := new(mockCounter) - fakePanicDrop.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakePanicDrop) - fakePanicDrop.On("Add", 1.0).Return() - - // Fake Latency - fakeLatency := new(mockHistogram) - fakeLatency.On("With", []string{"url", w.Webhook.Config.URL, "code", "200"}).Return(fakeLatency) - fakeLatency.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakeLatency) - fakeLatency.On("Observe", 1.0).Return() - - // Build a registry and register all fake metrics, these are synymous with the metrics in - // metrics.go - // - // If a new metric within outboundsender is created it must be added here - fakeRegistry := new(mockCaduceusMetricsRegistry) - fakeRegistry.On("NewCounter", DeliveryRetryCounter).Return(fakeDC) - fakeRegistry.On("NewCounter", DeliveryCounter).Return(fakeDC) - fakeRegistry.On("NewCounter", OutgoingQueueDepth).Return(fakeDC) - fakeRegistry.On("NewCounter", SlowConsumerCounter).Return(fakeSlow) - fakeRegistry.On("NewCounter", SlowConsumerDroppedMsgCounter).Return(fakeDroppedSlow) - fakeRegistry.On("NewCounter", DropsDueToPanic).Return(fakePanicDrop) - fakeRegistry.On("NewGauge", OutgoingQueueDepth).Return(fakeQdepth) - fakeRegistry.On("NewGauge", DeliveryRetryMaxGauge).Return(fakeQdepth) - fakeRegistry.On("NewGauge", ConsumerRenewalTimeGauge).Return(fakeQdepth) - fakeRegistry.On("NewGauge", ConsumerDeliverUntilGauge).Return(fakeQdepth) - fakeRegistry.On("NewGauge", ConsumerDropUntilGauge).Return(fakeQdepth) - fakeRegistry.On("NewGauge", ConsumerDeliveryWorkersGauge).Return(fakeQdepth) - fakeRegistry.On("NewGauge", ConsumerMaxDeliveryWorkersGauge).Return(fakeQdepth) - fakeRegistry.On("NewHistogram", QueryDurationHistogram).Return(fakeLatency) - - return &OutboundSenderFactory{ - Sender: doerFunc((&http.Client{Transport: trans}).Do), - CutOffPeriod: cutOffPeriod, - NumWorkers: 10, - QueueSize: 10, - DeliveryRetries: 1, - MetricsRegistry: fakeRegistry, - Logger: zap.NewNop(), - } -} - -func simpleRequest() *wrp.Message { - return &wrp.Message{ - Source: "mac:112233445566/lmlite", - TransactionUUID: "1234", - ContentType: wrp.MimeTypeMsgpack, - Destination: "event:bob/magic/dog", - Payload: []byte("Hello, world."), - } -} - -func simpleRequestWithPartnerIDs() *wrp.Message { - return &wrp.Message{ - Source: "mac:112233445566/lmlite", - TransactionUUID: "1234", - ContentType: wrp.MimeTypeMsgpack, - Destination: "event:bob/magic/dog", - Payload: []byte("Hello, world."), - PartnerIDs: []string{"comcast"}, - } -} - -// Simple test that covers the normal successful case with no extra matchers -func TestSimpleWrp(t *testing.T) { - fmt.Printf("\n\nTestingSimpleWRP:\n\n") - - assert := assert.New(t) - - trans := &transport{} - - fmt.Printf("SimpleSetup:\n") - obs, err := simpleSetup(trans, time.Second, nil) - assert.NotNil(obs) - assert.Nil(err) - - // queue case 1 - req := simpleRequestWithPartnerIDs() - req.Destination = "event:iot" - fmt.Printf("Queue case 1:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - req = simpleRequestWithPartnerIDs() - req.Destination = "event:test" - fmt.Printf("\nQueue case 2:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - // queue case 3 - req = simpleRequestWithPartnerIDs() - req.Destination = "event:no-match" - fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - // queue case 4 - req = simpleRequestWithPartnerIDs() - req.ContentType = wrp.MimeTypeJson - fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - req = simpleRequestWithPartnerIDs() - req.ContentType = "application/http" - fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - req = simpleRequestWithPartnerIDs() - req.ContentType = "unknown" - fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - obs.Shutdown(true) - - assert.Equal(int32(2), trans.i) -} - -func TestSimpleWrpPartnerIDsFailure(t *testing.T) { - fmt.Printf("\n\nTestingSimpleWRP:\n\n") - - assert := assert.New(t) - - trans := &transport{} - - fmt.Printf("SimpleSetup:\n") - obs, err := simpleSetup(trans, time.Second, nil) - assert.NotNil(obs) - assert.Nil(err) - - // queue case 1 - req := simpleRequest() - req.Destination = "event:iot" - fmt.Printf("Queue case 1:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - req = simpleRequest() - req.Destination = "event:test" - fmt.Printf("\nQueue case 2:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - // queue case 3 - req = simpleRequest() - req.Destination = "event:no-match" - fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - // queue case 4 - req = simpleRequest() - req.ContentType = wrp.MimeTypeJson - fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - req = simpleRequest() - req.ContentType = "application/http" - fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - req = simpleRequest() - req.ContentType = "unknown" - fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) - obs.Queue(req) - - obs.Shutdown(true) - - assert.Equal(int32(0), trans.i) -} - -// Simple test that covers the normal retry case -func TestSimpleRetry(t *testing.T) { - - assert := assert.New(t) - - trans := &transport{} - trans.fn = func(req *http.Request, count int) (*http.Response, error) { - return nil, &net.DNSError{IsTemporary: true} - } - - obs, err := simpleSetup(trans, time.Second, nil) - assert.NotNil(obs) - assert.Nil(err) - - req := simpleRequestWithPartnerIDs() - req.Source = "mac:112233445566" - req.TransactionUUID = "1234" - req.Destination = "event:iot" - obs.Queue(req) - - obs.Shutdown(true) - - assert.Equal(int32(2), trans.i) -} - -func Test429Retry(t *testing.T) { - - assert := assert.New(t) - - trans := &transport{} - trans.fn = func(req *http.Request, count int) (*http.Response, error) { - return &http.Response{StatusCode: 429}, nil - } - - obs, err := simpleSetup(trans, time.Second, nil) - - assert.NotNil(obs) - assert.Nil(err) - - req := simpleRequestWithPartnerIDs() - req.Source = "mac:112233445566" - req.TransactionUUID = "1234" - req.Destination = "event:iot" - obs.Queue(req) +// import ( +// "bytes" +// "fmt" + +// "github.com/davecgh/go-spew/spew" +// "github.com/stretchr/testify/assert" +// "github.com/xmidt-org/ancla" +// "github.com/xmidt-org/wrp-go/v3" +// "go.uber.org/zap" +// "go.uber.org/zap/zapcore" + +// //"github.com/stretchr/testify/mock" +// "io" +// "net" +// "net/http" +// "sync/atomic" +// "testing" +// "time" +// ) + +// // Make a simple RoundTrip implementation that let's me short-circuit the network +// type transport struct { +// i int32 +// fn func(*http.Request, int) (*http.Response, error) +// } + +// func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { +// i := atomic.AddInt32(&t.i, 1) +// return t.fn(req, int(i)) +// } + +// func getNewTestOutputLogger(out io.Writer) *zap.Logger { +// var b bytes.Buffer + +// return zap.New( +// zapcore.NewCore(zapcore.NewJSONEncoder( +// zapcore.EncoderConfig{ +// MessageKey: "message", +// }), zapcore.AddSync(&b), zapcore.ErrorLevel), +// ) +// } + +// // func simpleSetup(trans *transport, cutOffPeriod time.Duration, matcher []string) (OutboundSender, error) { +// // return simpleFactorySetup(trans, cutOffPeriod, matcher).New() +// // } + +// // // simpleFactorySetup sets up a outboundSender with metrics. +// // // +// // // # Using Caduceus's test suite +// // // +// // // If you are testing a new metric it needs to be created in this process below. +// // // 1. Create a fake, mockMetric i.e fakeEventType := new(mockCounter) +// // // 2. If your metric type has yet to be included in mockCaduceusMetricRegistry within mocks.go +// // // add your metric type to mockCaduceusMetricRegistry +// // // 3. Trigger the On method on that "mockMetric" with various different cases of that metric, +// // // in both senderWrapper_test.go and outboundSender_test.go +// // // i.e: +// // // case 1: On("With", []string{"event", iot} +// // // case 2: On("With", []string{"event", unknown} +// // // 4. Mimic the metric behavior using On: +// // // fakeSlow.On("Add", 1.0).Return() +// // func simpleFactorySetup(trans *transport, cutOffPeriod time.Duration, matcher []string) *OutboundSenderFactory { +// // if nil == trans.fn { +// // trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { +// // resp = &http.Response{Status: "200 OK", +// // StatusCode: 200, +// // } +// // return +// // } +// // } + +// // // w := ancla.InternalWebhook{ +// // // Webhook: ancla.Webhook{ +// // // Until: time.Now().Add(60 * time.Second), +// // // Events: []string{"iot", "test"}, +// // // Config: ancla.DeliveryConfig{ +// // // URL: "http://localhost:9999/foo", +// // // ContentType: wrp.MimeTypeJson, +// // // Secret: "123456", +// // // }, +// // // }, +// // // PartnerIDs: []string{"comcast"}, +// // // } +// // // w.Webhook.Matcher.DeviceID = matcher + +// // // test dc metric +// // fakeDC := new(mockCounter) +// // fakeDC.On("With", []string{"url", w.Webhook.Config.URL, "code", "200", "event", "test"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "200", "event", "iot"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "200", "event", "unknown"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "failure", "event", "iot"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "event", "test"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "event", "iot"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "event", "unknown"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "201"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "202"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "204"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "429", "event", "iot"}).Return(fakeDC). +// // On("With", []string{"url", w.Webhook.Config.URL, "code", "failure"}).Return(fakeDC) +// // fakeDC.On("Add", 1.0).Return() +// // fakeDC.On("Add", 0.0).Return() + +// // // test slow metric +// // fakeSlow := new(mockCounter) +// // fakeSlow.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakeSlow) +// // fakeSlow.On("Add", 1.0).Return() + +// // // test dropped metric +// // fakeDroppedSlow := new(mockCounter) +// // fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "queue_full"}).Return(fakeDroppedSlow) +// // fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "cut_off"}).Return(fakeDroppedSlow) +// // fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "expired"}).Return(fakeDroppedSlow) +// // fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "expired_before_queueing"}).Return(fakeDroppedSlow) +// // fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "invalid_config"}).Return(fakeDroppedSlow) +// // fakeDroppedSlow.On("With", []string{"url", w.Webhook.Config.URL, "reason", "network_err"}).Return(fakeDroppedSlow) +// // fakeDroppedSlow.On("Add", mock.Anything).Return() + +// // // IncomingContentType cases +// // fakeContentType := new(mockCounter) +// // fakeContentType.On("With", []string{"content_type", "msgpack"}).Return(fakeContentType) +// // fakeContentType.On("With", []string{"content_type", "json"}).Return(fakeContentType) +// // fakeContentType.On("With", []string{"content_type", "http"}).Return(fakeContentType) +// // fakeContentType.On("With", []string{"content_type", "other"}).Return(fakeContentType) +// // fakeContentType.On("Add", 1.0).Return() + +// // // QueueDepth case +// // fakeQdepth := new(mockGauge) +// // fakeQdepth.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakeQdepth) +// // fakeQdepth.On("Add", 1.0).Return().On("Add", -1.0).Return() + +// // // DropsDueToPanic case +// // fakePanicDrop := new(mockCounter) +// // fakePanicDrop.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakePanicDrop) +// // fakePanicDrop.On("Add", 1.0).Return() + +// // // Fake Latency +// // fakeLatency := new(mockHistogram) +// // fakeLatency.On("With", []string{"url", w.Webhook.Config.URL, "code", "200"}).Return(fakeLatency) +// // fakeLatency.On("With", []string{"url", w.Webhook.Config.URL}).Return(fakeLatency) +// // fakeLatency.On("Observe", 1.0).Return() + +// // // Build a registry and register all fake metrics, these are synymous with the metrics in +// // // metrics.go +// // // +// // // If a new metric within outboundsender is created it must be added here +// // fakeRegistry := new(mockCaduceusMetricsRegistry) +// // fakeRegistry.On("NewCounter", DeliveryRetryCounter).Return(fakeDC) +// // fakeRegistry.On("NewCounter", DeliveryCounter).Return(fakeDC) +// // fakeRegistry.On("NewCounter", OutgoingQueueDepth).Return(fakeDC) +// // fakeRegistry.On("NewCounter", SlowConsumerCounter).Return(fakeSlow) +// // fakeRegistry.On("NewCounter", SlowConsumerDroppedMsgCounter).Return(fakeDroppedSlow) +// // fakeRegistry.On("NewCounter", DropsDueToPanic).Return(fakePanicDrop) +// // fakeRegistry.On("NewGauge", OutgoingQueueDepth).Return(fakeQdepth) +// // fakeRegistry.On("NewGauge", DeliveryRetryMaxGauge).Return(fakeQdepth) +// // fakeRegistry.On("NewGauge", ConsumerRenewalTimeGauge).Return(fakeQdepth) +// // fakeRegistry.On("NewGauge", ConsumerDeliverUntilGauge).Return(fakeQdepth) +// // fakeRegistry.On("NewGauge", ConsumerDropUntilGauge).Return(fakeQdepth) +// // fakeRegistry.On("NewGauge", ConsumerDeliveryWorkersGauge).Return(fakeQdepth) +// // fakeRegistry.On("NewGauge", ConsumerMaxDeliveryWorkersGauge).Return(fakeQdepth) +// // fakeRegistry.On("NewHistogram", QueryDurationHistogram).Return(fakeLatency) + +// // return &OutboundSenderFactory{ +// // Sender: doerFunc((&http.Client{Transport: trans}).Do), +// // CutOffPeriod: cutOffPeriod, +// // NumWorkers: 10, +// // QueueSize: 10, +// // DeliveryRetries: 1, +// // MetricsRegistry: fakeRegistry, +// // Logger: zap.NewNop(), +// // } +// // } + +// func simpleRequest() *wrp.Message { +// return &wrp.Message{ +// Source: "mac:112233445566/lmlite", +// TransactionUUID: "1234", +// ContentType: wrp.MimeTypeMsgpack, +// Destination: "event:bob/magic/dog", +// Payload: []byte("Hello, world."), +// } +// } + +// func simpleRequestWithPartnerIDs() *wrp.Message { +// return &wrp.Message{ +// Source: "mac:112233445566/lmlite", +// TransactionUUID: "1234", +// ContentType: wrp.MimeTypeMsgpack, +// Destination: "event:bob/magic/dog", +// Payload: []byte("Hello, world."), +// PartnerIDs: []string{"comcast"}, +// } +// } + +// // Simple test that covers the normal successful case with no extra matchers +// func TestSimpleWrp(t *testing.T) { +// fmt.Printf("\n\nTestingSimpleWRP:\n\n") + +// assert := assert.New(t) + +// trans := &transport{} + +// fmt.Printf("SimpleSetup:\n") +// obs, err := simpleSetup(trans, time.Second, nil) +// assert.NotNil(obs) +// assert.Nil(err) + +// // queue case 1 +// req := simpleRequestWithPartnerIDs() +// req.Destination = "event:iot" +// fmt.Printf("Queue case 1:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// req = simpleRequestWithPartnerIDs() +// req.Destination = "event:test" +// fmt.Printf("\nQueue case 2:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// // queue case 3 +// req = simpleRequestWithPartnerIDs() +// req.Destination = "event:no-match" +// fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// // queue case 4 +// req = simpleRequestWithPartnerIDs() +// req.ContentType = wrp.MimeTypeJson +// fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// req = simpleRequestWithPartnerIDs() +// req.ContentType = "application/http" +// fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// req = simpleRequestWithPartnerIDs() +// req.ContentType = "unknown" +// fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// obs.Shutdown(true) + +// assert.Equal(int32(2), trans.i) +// } + +// func TestSimpleWrpPartnerIDsFailure(t *testing.T) { +// fmt.Printf("\n\nTestingSimpleWRP:\n\n") + +// assert := assert.New(t) + +// trans := &transport{} + +// fmt.Printf("SimpleSetup:\n") +// obs, err := simpleSetup(trans, time.Second, nil) +// assert.NotNil(obs) +// assert.Nil(err) + +// // queue case 1 +// req := simpleRequest() +// req.Destination = "event:iot" +// fmt.Printf("Queue case 1:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// req = simpleRequest() +// req.Destination = "event:test" +// fmt.Printf("\nQueue case 2:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// // queue case 3 +// req = simpleRequest() +// req.Destination = "event:no-match" +// fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// // queue case 4 +// req = simpleRequest() +// req.ContentType = wrp.MimeTypeJson +// fmt.Printf("\nQueue case 3:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// req = simpleRequest() +// req.ContentType = "application/http" +// fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// req = simpleRequest() +// req.ContentType = "unknown" +// fmt.Printf("\nQueue case 4:\n %v\n", spew.Sprint(req)) +// obs.Queue(req) + +// obs.Shutdown(true) + +// assert.Equal(int32(0), trans.i) +// } + +// // Simple test that covers the normal retry case +// func TestSimpleRetry(t *testing.T) { + +// assert := assert.New(t) + +// trans := &transport{} +// trans.fn = func(req *http.Request, count int) (*http.Response, error) { +// return nil, &net.DNSError{IsTemporary: true} +// } + +// obs, err := simpleSetup(trans, time.Second, nil) +// assert.NotNil(obs) +// assert.Nil(err) + +// req := simpleRequestWithPartnerIDs() +// req.Source = "mac:112233445566" +// req.TransactionUUID = "1234" +// req.Destination = "event:iot" +// obs.Queue(req) + +// obs.Shutdown(true) + +// assert.Equal(int32(2), trans.i) +// } + +// func Test429Retry(t *testing.T) { + +// assert := assert.New(t) + +// trans := &transport{} +// trans.fn = func(req *http.Request, count int) (*http.Response, error) { +// return &http.Response{StatusCode: 429}, nil +// } + +// obs, err := simpleSetup(trans, time.Second, nil) + +// assert.NotNil(obs) +// assert.Nil(err) + +// req := simpleRequestWithPartnerIDs() +// req.Source = "mac:112233445566" +// req.TransactionUUID = "1234" +// req.Destination = "event:iot" +// obs.Queue(req) - obs.Shutdown(true) +// obs.Shutdown(true) - assert.Equal(int32(2), trans.i) -} +// assert.Equal(int32(2), trans.i) +// } -func TestAltURL(t *testing.T) { - assert := assert.New(t) +// func TestAltURL(t *testing.T) { +// assert := assert.New(t) - urls := map[string]int{} +// urls := map[string]int{} - w := ancla.InternalWebhook{ - Webhook: ancla.Webhook{ - Until: time.Now().Add(60 * time.Second), - Events: []string{".*"}, - }, - PartnerIDs: []string{"comcast"}, - } - w.Webhook.Config.URL = "http://localhost:9999/foo" - w.Webhook.Config.ContentType = wrp.MimeTypeJson - w.Webhook.Config.AlternativeURLs = []string{ - "http://localhost:9999/foo", - "http://localhost:9999/bar", - "http://localhost:9999/faa", - "http://localhost:9999/bas", - } - - trans := &transport{} - trans.fn = func(req *http.Request, count int) (*http.Response, error) { - urls[req.URL.Path] += 1 - return &http.Response{StatusCode: 429}, nil - } - - obs, err := simpleSetup(trans, time.Second, nil) - assert.Nil(err) - // err = obs.Update(w) - assert.NotNil(obs) - assert.Nil(err) - - req := simpleRequestWithPartnerIDs() - req.Source = "mac:112233445566" - req.TransactionUUID = "1234" - req.Destination = "event:iot" - obs.Queue(req) +// w := ancla.InternalWebhook{ +// Webhook: ancla.Webhook{ +// Until: time.Now().Add(60 * time.Second), +// Events: []string{".*"}, +// }, +// PartnerIDs: []string{"comcast"}, +// } +// w.Webhook.Config.URL = "http://localhost:9999/foo" +// w.Webhook.Config.ContentType = wrp.MimeTypeJson +// w.Webhook.Config.AlternativeURLs = []string{ +// "http://localhost:9999/foo", +// "http://localhost:9999/bar", +// "http://localhost:9999/faa", +// "http://localhost:9999/bas", +// } + +// trans := &transport{} +// trans.fn = func(req *http.Request, count int) (*http.Response, error) { +// urls[req.URL.Path] += 1 +// return &http.Response{StatusCode: 429}, nil +// } + +// obs, err := simpleSetup(trans, time.Second, nil) +// assert.Nil(err) +// // err = obs.Update(w) +// assert.NotNil(obs) +// assert.Nil(err) + +// req := simpleRequestWithPartnerIDs() +// req.Source = "mac:112233445566" +// req.TransactionUUID = "1234" +// req.Destination = "event:iot" +// obs.Queue(req) - obs.Shutdown(true) +// obs.Shutdown(true) - assert.Equal(int32(2), trans.i) - for k, v := range urls { - assert.Equal(1, v, k) - } -} +// assert.Equal(int32(2), trans.i) +// for k, v := range urls { +// assert.Equal(1, v, k) +// } +// } -// Simple test that covers the normal successful case with extra matchers -func TestSimpleWrpWithMatchers(t *testing.T) { +// // Simple test that covers the normal successful case with extra matchers +// func TestSimpleWrpWithMatchers(t *testing.T) { - assert := assert.New(t) +// assert := assert.New(t) - m := []string{"mac:112233445566", "mac:112233445565"} +// m := []string{"mac:112233445566", "mac:112233445565"} - trans := &transport{} - obs, err := simpleSetup(trans, time.Second, m) - assert.Nil(err) - - req := simpleRequestWithPartnerIDs() - req.TransactionUUID = "1234" - req.Source = "mac:112233445566" - req.Destination = "event:iot" - obs.Queue(req) +// trans := &transport{} +// obs, err := simpleSetup(trans, time.Second, m) +// assert.Nil(err) + +// req := simpleRequestWithPartnerIDs() +// req.TransactionUUID = "1234" +// req.Source = "mac:112233445566" +// req.Destination = "event:iot" +// obs.Queue(req) - r2 := simpleRequestWithPartnerIDs() - r2.TransactionUUID = "1234" - r2.Source = "mac:112233445565" - r2.Destination = "event:test" - obs.Queue(r2) +// r2 := simpleRequestWithPartnerIDs() +// r2.TransactionUUID = "1234" +// r2.Source = "mac:112233445565" +// r2.Destination = "event:test" +// obs.Queue(r2) - r3 := simpleRequest() - r3.TransactionUUID = "1234" - r3.Source = "mac:112233445560" - r3.Destination = "event:iot" - obs.Queue(r3) - - r4 := simpleRequest() - r4.TransactionUUID = "1234" - r4.Source = "mac:112233445560" - r4.Destination = "event:test" - obs.Queue(r4) +// r3 := simpleRequest() +// r3.TransactionUUID = "1234" +// r3.Source = "mac:112233445560" +// r3.Destination = "event:iot" +// obs.Queue(r3) + +// r4 := simpleRequest() +// r4.TransactionUUID = "1234" +// r4.Source = "mac:112233445560" +// r4.Destination = "event:test" +// obs.Queue(r4) - obs.Shutdown(true) +// obs.Shutdown(true) - assert.Equal(int32(2), trans.i) -} - -// Simple test that covers the normal successful case with extra wildcard matcher -func TestSimpleWrpWithWildcardMatchers(t *testing.T) { - - assert := assert.New(t) - - trans := &transport{} +// assert.Equal(int32(2), trans.i) +// } + +// // Simple test that covers the normal successful case with extra wildcard matcher +// func TestSimpleWrpWithWildcardMatchers(t *testing.T) { + +// assert := assert.New(t) + +// trans := &transport{} - m := []string{"mac:112233445566", ".*"} +// m := []string{"mac:112233445566", ".*"} - obs, err := simpleSetup(trans, time.Second, m) - assert.Nil(err) +// obs, err := simpleSetup(trans, time.Second, m) +// assert.Nil(err) - req := simpleRequestWithPartnerIDs() - req.TransactionUUID = "1234" - req.Source = "mac:112233445566" - req.Destination = "event:iot" - obs.Queue(req) +// req := simpleRequestWithPartnerIDs() +// req.TransactionUUID = "1234" +// req.Source = "mac:112233445566" +// req.Destination = "event:iot" +// obs.Queue(req) - r2 := simpleRequestWithPartnerIDs() - r2.TransactionUUID = "1234" - r2.Source = "mac:112233445565" - r2.Destination = "event:test" - obs.Queue(r2) +// r2 := simpleRequestWithPartnerIDs() +// r2.TransactionUUID = "1234" +// r2.Source = "mac:112233445565" +// r2.Destination = "event:test" +// obs.Queue(r2) - r3 := simpleRequestWithPartnerIDs() - r3.TransactionUUID = "1234" - r3.Source = "mac:112233445560" - r3.Destination = "event:iot" - obs.Queue(r3) +// r3 := simpleRequestWithPartnerIDs() +// r3.TransactionUUID = "1234" +// r3.Source = "mac:112233445560" +// r3.Destination = "event:iot" +// obs.Queue(r3) - r4 := simpleRequestWithPartnerIDs() - r4.TransactionUUID = "1234" - r4.Source = "mac:112233445560" - r4.Destination = "event:test" - obs.Queue(r4) +// r4 := simpleRequestWithPartnerIDs() +// r4.TransactionUUID = "1234" +// r4.Source = "mac:112233445560" +// r4.Destination = "event:test" +// obs.Queue(r4) - /* This will panic. */ - r5 := simpleRequestWithPartnerIDs() - r5.TransactionUUID = "1234" - r5.Source = "mac:112233445560" - r5.Destination = "event:test\xedoops" - obs.Queue(r5) +// /* This will panic. */ +// r5 := simpleRequestWithPartnerIDs() +// r5.TransactionUUID = "1234" +// r5.Source = "mac:112233445560" +// r5.Destination = "event:test\xedoops" +// obs.Queue(r5) - obs.Shutdown(true) +// obs.Shutdown(true) - assert.Equal(int32(4), trans.i) -} +// assert.Equal(int32(4), trans.i) +// } -/* -// Simple test that covers the normal successful case with extra matchers -func TestSimpleWrpWithMetadata(t *testing.T) { +// /* +// // Simple test that covers the normal successful case with extra matchers +// func TestSimpleWrpWithMetadata(t *testing.T) { - assert := assert.New(t) +// assert := assert.New(t) - m := make(map[string][]string) - m["device_id"] = []string{"mac:112233445566", "mac:112233445565"} - m["metadata"] = []string{"cheese", "crackers"} +// m := make(map[string][]string) +// m["device_id"] = []string{"mac:112233445566", "mac:112233445565"} +// m["metadata"] = []string{"cheese", "crackers"} - trans := &transport{} - obs, err := simpleSetup(trans, time.Second, m) - assert.Nil(err) +// trans := &transport{} +// obs, err := simpleSetup(trans, time.Second, m) +// assert.Nil(err) - req := simpleRequest() +// req := simpleRequest() - wrpMeta := make(map[string]string) - wrpMeta["metadata"] = "crackers" +// wrpMeta := make(map[string]string) +// wrpMeta["metadata"] = "crackers" - obs.Queue(req, wrpMeta, "iot", "mac:112233445565", "1234") - obs.Queue(req, wrpMeta, "test", "mac:112233445566", "1234") - obs.Queue(req, wrpMeta, "iot", "mac:112233445560", "1234") - obs.Queue(req, wrpMeta, "test", "mac:112233445560", "1234") +// obs.Queue(req, wrpMeta, "iot", "mac:112233445565", "1234") +// obs.Queue(req, wrpMeta, "test", "mac:112233445566", "1234") +// obs.Queue(req, wrpMeta, "iot", "mac:112233445560", "1234") +// obs.Queue(req, wrpMeta, "test", "mac:112233445560", "1234") - obs.Shutdown(true) +// obs.Shutdown(true) - assert.Equal(int32(2), trans.i) -} -*/ /* -// Simple test that covers the normal successful case with extra matchers -func TestInvalidWrpMetadata(t *testing.T) { +// assert.Equal(int32(2), trans.i) +// } +// */ /* +// // Simple test that covers the normal successful case with extra matchers +// func TestInvalidWrpMetadata(t *testing.T) { - assert := assert.New(t) +// assert := assert.New(t) - m := make(map[string][]string) - m["device_id"] = []string{"mac:112233445566", "mac:112233445565"} - m["metadata"] = []string{"cheese", "crackers"} +// m := make(map[string][]string) +// m["device_id"] = []string{"mac:112233445566", "mac:112233445565"} +// m["metadata"] = []string{"cheese", "crackers"} - trans := &transport{} - obs, err := simpleSetup(trans, time.Second, m) - assert.Nil(err) +// trans := &transport{} +// obs, err := simpleSetup(trans, time.Second, m) +// assert.Nil(err) - req := simpleRequest() +// req := simpleRequest() - wrpMeta := make(map[string]string) - wrpMeta["metadata"] = "notpresent" +// wrpMeta := make(map[string]string) +// wrpMeta["metadata"] = "notpresent" - obs.Queue(req, wrpMeta, "iot", "mac:112233445565", "1234") - obs.Queue(req, wrpMeta, "test", "mac:112233445566", "1234") - obs.Queue(req, wrpMeta, "iot", "mac:112233445560", "1234") - obs.Queue(req, wrpMeta, "test", "mac:112233445560", "1234") +// obs.Queue(req, wrpMeta, "iot", "mac:112233445565", "1234") +// obs.Queue(req, wrpMeta, "test", "mac:112233445566", "1234") +// obs.Queue(req, wrpMeta, "iot", "mac:112233445560", "1234") +// obs.Queue(req, wrpMeta, "test", "mac:112233445560", "1234") - obs.Shutdown(true) +// obs.Shutdown(true) - assert.Equal(int32(0), trans.i) -} -*/ - -// Simple test that checks for invalid match regex -func TestInvalidMatchRegex(t *testing.T) { - - assert := assert.New(t) - - trans := &transport{} - - m := []string{"[[:112233445566"} - - obs, err := simpleSetup(trans, time.Second, m) - assert.Nil(obs) - assert.NotNil(err) -} - -// Simple test that checks for invalid cutoff period -func TestInvalidCutOffPeriod(t *testing.T) { - - assert := assert.New(t) - - trans := &transport{} - - obs, err := simpleSetup(trans, 0*time.Second, nil) - assert.Nil(obs) - assert.NotNil(err) -} - -// Simple test that checks for invalid event regex -func TestInvalidEventRegex(t *testing.T) { - - assert := assert.New(t) - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now().Add(60 * time.Second), - // Events: []string{"[[:123"}, - // }, - // } - // w.Webhook.Config.URL = "http://localhost:9999/foo" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - obs, err := OutboundSenderFactory{ - // Listener: w, - Sender: doerFunc((&http.Client{}).Do), - NumWorkers: 10, - QueueSize: 10, - Logger: zap.NewNop(), - }.New() - assert.Nil(obs) - assert.NotNil(err) - -} - -// Simple test that checks for invalid url regex -func TestInvalidUrl(t *testing.T) { - - assert := assert.New(t) - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now().Add(60 * time.Second), - // Events: []string{"iot"}, - // }, - // } - // w.Webhook.Config.URL = "invalid" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - obs, err := OutboundSenderFactory{ - // Listener: w, - Sender: doerFunc((&http.Client{}).Do), - NumWorkers: 10, - QueueSize: 10, - Logger: zap.NewNop(), - }.New() - assert.Nil(obs) - assert.NotNil(err) - - // w2 := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now().Add(60 * time.Second), - // Events: []string{"iot"}, - // }, - // } - // w2.Webhook.Config.ContentType = wrp.MimeTypeJson - - obs, err = OutboundSenderFactory{ - // Listener: w2, - Sender: doerFunc((&http.Client{}).Do), - NumWorkers: 10, - QueueSize: 10, - Logger: zap.NewNop(), - }.New() - assert.Nil(obs) - assert.NotNil(err) - -} - -// Simple test that checks for invalid Sender -func TestInvalidSender(t *testing.T) { - assert := assert.New(t) - - trans := &transport{} - obsf := simpleFactorySetup(trans, time.Second, nil) - obsf.Sender = nil - obs, err := obsf.New() - assert.Nil(obs) - assert.NotNil(err) -} - -// Simple test that checks for no logger -func TestInvalidLogger(t *testing.T) { - assert := assert.New(t) - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now().Add(60 * time.Second), - // Events: []string{"iot"}, - // }, - // } - // w.Webhook.Config.URL = "http://localhost:9999/foo" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - trans := &transport{} - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w - obsf.Sender = doerFunc((&http.Client{}).Do) - obsf.Logger = nil - obs, err := obsf.New() - - assert.Nil(obs) - assert.NotNil(err) -} - -// Simple test that checks for FailureURL behavior -func TestFailureURL(t *testing.T) { - assert := assert.New(t) - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now().Add(60 * time.Second), - // FailureURL: "invalid", - // Events: []string{"iot"}, - // }, - // } - // w.Webhook.Config.URL = "http://localhost:9999/foo" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - trans := &transport{} - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w - obsf.Sender = doerFunc((&http.Client{}).Do) - obs, err := obsf.New() - assert.Nil(obs) - assert.NotNil(err) -} - -// Simple test that checks for no events -func TestInvalidEvents(t *testing.T) { - assert := assert.New(t) - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now().Add(60 * time.Second), - // }, - // } - // w.Webhook.Config.URL = "http://localhost:9999/foo" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - trans := &transport{} - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w - obsf.Sender = doerFunc((&http.Client{}).Do) - obs, err := obsf.New() - - assert.Nil(obs) - assert.NotNil(err) - - // w2 := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now().Add(60 * time.Second), - // Events: []string{"iot(.*"}, - // }, - // } - // w2.Webhook.Config.URL = "http://localhost:9999/foo" - // w2.Webhook.Config.ContentType = wrp.MimeTypeJson - - obsf = simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w2 - obsf.Sender = doerFunc((&http.Client{}).Do) - obs, err = obsf.New() - - assert.Nil(obs) - assert.NotNil(err) -} - -// TODO: improve test -// Simple test that ensures that Update() works -func TestUpdate(t *testing.T) { - assert := assert.New(t) - - now := time.Now() - // w1 := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: now, - // Events: []string{"iot", "test"}, - // }, - // } - // w1.Webhook.Config.URL = "http://localhost:9999/foo" - // w1.Webhook.Config.ContentType = wrp.MimeTypeMsgpack - - later := time.Now().Add(30 * time.Second) - // w2 := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: later, - // Events: []string{"more", "messages"}, - // }, - // } - // w2.Webhook.Config.URL = "http://localhost:9999/foo" - // w2.Webhook.Config.ContentType = wrp.MimeTypeMsgpack - - trans := &transport{} - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w1 - obsf.Sender = doerFunc((&http.Client{}).Do) - obs, err := obsf.New() - assert.Nil(err) - - if _, ok := obs.(*CaduceusOutboundSender); !ok { - assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") - } - - assert.Equal(now, obs.(*CaduceusOutboundSender).deliverUntil, "Delivery should match original value.") - // obs.Update(w2) - assert.Equal(later, obs.(*CaduceusOutboundSender).deliverUntil, "Delivery should match new value.") - - obs.Shutdown(true) -} - -// No FailureURL -func TestOverflowNoFailureURL(t *testing.T) { - assert := assert.New(t) - - var output bytes.Buffer - logger := getNewTestOutputLogger(&output) - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now(), - // Events: []string{"iot", "test"}, - // }, - // } - // w.Webhook.Config.URL = "http://localhost:9999/foo" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - trans := &transport{} - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w - obsf.Logger = logger - obsf.Sender = doerFunc((&http.Client{}).Do) - obs, err := obsf.New() - - assert.Nil(err) - - if _, ok := obs.(*CaduceusOutboundSender); !ok { - assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") - } - - obs.(*CaduceusOutboundSender).queueOverflow() - assert.NotNil(output.String()) -} - -// Valid FailureURL -func TestOverflowValidFailureURL(t *testing.T) { - assert := assert.New(t) - - var output bytes.Buffer - logger := getNewTestOutputLogger(&output) - - trans := &transport{} - trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { - assert.Equal("POST", req.Method) - assert.Equal([]string{wrp.MimeTypeJson}, req.Header["Content-Type"]) - assert.Nil(req.Header["X-Webpa-Signature"]) - payload, _ := io.ReadAll(req.Body) - // There is a timestamp in the body, so it's not worth trying to do a string comparison - assert.NotNil(payload) - - resp = &http.Response{Status: "200 OK", - StatusCode: 200, - } - return - } - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now(), - // FailureURL: "http://localhost:12345/bar", - // Events: []string{"iot", "test"}, - // }, - // } - // w.Webhook.Config.URL = "http://localhost:9999/foo" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w - obsf.Logger = logger - obs, err := obsf.New() - assert.Nil(err) - - if _, ok := obs.(*CaduceusOutboundSender); !ok { - assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") - } - - obs.(*CaduceusOutboundSender).queueOverflow() - assert.NotNil(output.String()) -} - -// Valid FailureURL with secret -func TestOverflowValidFailureURLWithSecret(t *testing.T) { - assert := assert.New(t) - - var output bytes.Buffer - logger := getNewTestOutputLogger(&output) - - trans := &transport{} - trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { - assert.Equal("POST", req.Method) - assert.Equal([]string{wrp.MimeTypeJson}, req.Header["Content-Type"]) - // There is a timestamp in the body, so it's not worth trying to do a string comparison - assert.NotNil(req.Header["X-Webpa-Signature"]) - payload, _ := io.ReadAll(req.Body) - assert.NotNil(payload) - - resp = &http.Response{Status: "200 OK", - StatusCode: 200, - } - return - } - - w := ancla.InternalWebhook{ - Webhook: ancla.Webhook{ - Until: time.Now(), - FailureURL: "http://localhost:12345/bar", - Events: []string{"iot", "test"}, - }, - } - w.Webhook.Config.URL = "http://localhost:9999/foo" - w.Webhook.Config.ContentType = wrp.MimeTypeJson - w.Webhook.Config.Secret = "123456" - - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w - obsf.Logger = logger - obs, err := obsf.New() - assert.Nil(err) - - if _, ok := obs.(*CaduceusOutboundSender); !ok { - assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") - } - - obs.(*CaduceusOutboundSender).queueOverflow() - assert.NotNil(output.String()) -} - -// Valid FailureURL, failed to send, error -func TestOverflowValidFailureURLError(t *testing.T) { - assert := assert.New(t) - - var output bytes.Buffer - logger := getNewTestOutputLogger(&output) - - trans := &transport{} - trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { - resp = nil - err = fmt.Errorf("My Error.") - return - } - - // w := ancla.InternalWebhook{ - // Webhook: ancla.Webhook{ - // Until: time.Now(), - // FailureURL: "http://localhost:12345/bar", - // Events: []string{"iot", "test"}, - // }, - // } - // w.Webhook.Config.URL = "http://localhost:9999/foo" - // w.Webhook.Config.ContentType = wrp.MimeTypeJson - - obsf := simpleFactorySetup(trans, time.Second, nil) - // obsf.Listener = w - obsf.Logger = logger - obs, err := obsf.New() - assert.Nil(err) - - if _, ok := obs.(*CaduceusOutboundSender); !ok { - assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") - } - - obs.(*CaduceusOutboundSender).queueOverflow() - assert.NotNil(output.String()) -} - -// Valid Overflow case -func TestOverflow(t *testing.T) { - assert := assert.New(t) - - var output bytes.Buffer - logger := getNewTestOutputLogger(&output) - - block := int32(0) - trans := &transport{} - trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { - if req.URL.String() == "http://localhost:9999/foo" { - assert.Equal([]string{"01234"}, req.Header["X-Webpa-Transaction-Id"]) - - // Sleeping until we're told to return - for 0 == atomic.LoadInt32(&block) { - time.Sleep(time.Microsecond) - } - } - - resp = &http.Response{Status: "200 OK", - StatusCode: 200, - } - return - } - - w := ancla.Webhook{ - Until: time.Now().Add(30 * time.Second), - FailureURL: "http://localhost:12345/bar", - Events: []string{"iot", "test"}, - } - w.Config.URL = "http://localhost:9999/foo" - w.Config.ContentType = wrp.MimeTypeJson - - obsf := simpleFactorySetup(trans, 4*time.Second, nil) - obsf.NumWorkers = 1 - obsf.QueueSize = 2 - obsf.Logger = logger - obs, err := obsf.New() - assert.Nil(err) - - req := simpleRequest() - - req.TransactionUUID = "01234" - obs.Queue(req) - req.TransactionUUID = "01235" - obs.Queue(req) - - // give the worker a chance to pick up one from the queue - time.Sleep(1 * time.Second) - - req.TransactionUUID = "01236" - obs.Queue(req) - req.TransactionUUID = "01237" - obs.Queue(req) - req.TransactionUUID = "01238" - obs.Queue(req) - atomic.AddInt32(&block, 1) - obs.Shutdown(false) - - assert.NotNil(output.String()) -} +// assert.Equal(int32(0), trans.i) +// } +// */ + +// // Simple test that checks for invalid match regex +// func TestInvalidMatchRegex(t *testing.T) { + +// assert := assert.New(t) + +// trans := &transport{} + +// m := []string{"[[:112233445566"} + +// obs, err := simpleSetup(trans, time.Second, m) +// assert.Nil(obs) +// assert.NotNil(err) +// } + +// // Simple test that checks for invalid cutoff period +// func TestInvalidCutOffPeriod(t *testing.T) { + +// assert := assert.New(t) + +// trans := &transport{} + +// obs, err := simpleSetup(trans, 0*time.Second, nil) +// assert.Nil(obs) +// assert.NotNil(err) +// } + +// // Simple test that checks for invalid event regex +// func TestInvalidEventRegex(t *testing.T) { + +// assert := assert.New(t) + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now().Add(60 * time.Second), +// // Events: []string{"[[:123"}, +// // }, +// // } +// // w.Webhook.Config.URL = "http://localhost:9999/foo" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// obs, err := OutboundSenderFactory{ +// // Listener: w, +// Sender: doerFunc((&http.Client{}).Do), +// NumWorkers: 10, +// QueueSize: 10, +// Logger: zap.NewNop(), +// }.New() +// assert.Nil(obs) +// assert.NotNil(err) + +// } + +// // Simple test that checks for invalid url regex +// func TestInvalidUrl(t *testing.T) { + +// assert := assert.New(t) + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now().Add(60 * time.Second), +// // Events: []string{"iot"}, +// // }, +// // } +// // w.Webhook.Config.URL = "invalid" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// obs, err := OutboundSenderFactory{ +// // Listener: w, +// Sender: doerFunc((&http.Client{}).Do), +// NumWorkers: 10, +// QueueSize: 10, +// Logger: zap.NewNop(), +// }.New() +// assert.Nil(obs) +// assert.NotNil(err) + +// // w2 := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now().Add(60 * time.Second), +// // Events: []string{"iot"}, +// // }, +// // } +// // w2.Webhook.Config.ContentType = wrp.MimeTypeJson + +// obs, err = OutboundSenderFactory{ +// // Listener: w2, +// Sender: doerFunc((&http.Client{}).Do), +// NumWorkers: 10, +// QueueSize: 10, +// Logger: zap.NewNop(), +// }.New() +// assert.Nil(obs) +// assert.NotNil(err) + +// } + +// // Simple test that checks for invalid Sender +// func TestInvalidSender(t *testing.T) { +// assert := assert.New(t) + +// trans := &transport{} +// obsf := simpleFactorySetup(trans, time.Second, nil) +// obsf.Sender = nil +// obs, err := obsf.New() +// assert.Nil(obs) +// assert.NotNil(err) +// } + +// // Simple test that checks for no logger +// func TestInvalidLogger(t *testing.T) { +// assert := assert.New(t) + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now().Add(60 * time.Second), +// // Events: []string{"iot"}, +// // }, +// // } +// // w.Webhook.Config.URL = "http://localhost:9999/foo" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// trans := &transport{} +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w +// obsf.Sender = doerFunc((&http.Client{}).Do) +// obsf.Logger = nil +// obs, err := obsf.New() + +// assert.Nil(obs) +// assert.NotNil(err) +// } + +// // Simple test that checks for FailureURL behavior +// func TestFailureURL(t *testing.T) { +// assert := assert.New(t) + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now().Add(60 * time.Second), +// // FailureURL: "invalid", +// // Events: []string{"iot"}, +// // }, +// // } +// // w.Webhook.Config.URL = "http://localhost:9999/foo" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// trans := &transport{} +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w +// obsf.Sender = doerFunc((&http.Client{}).Do) +// obs, err := obsf.New() +// assert.Nil(obs) +// assert.NotNil(err) +// } + +// // Simple test that checks for no events +// func TestInvalidEvents(t *testing.T) { +// assert := assert.New(t) + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now().Add(60 * time.Second), +// // }, +// // } +// // w.Webhook.Config.URL = "http://localhost:9999/foo" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// trans := &transport{} +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w +// obsf.Sender = doerFunc((&http.Client{}).Do) +// obs, err := obsf.New() + +// assert.Nil(obs) +// assert.NotNil(err) + +// // w2 := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now().Add(60 * time.Second), +// // Events: []string{"iot(.*"}, +// // }, +// // } +// // w2.Webhook.Config.URL = "http://localhost:9999/foo" +// // w2.Webhook.Config.ContentType = wrp.MimeTypeJson + +// obsf = simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w2 +// obsf.Sender = doerFunc((&http.Client{}).Do) +// obs, err = obsf.New() + +// assert.Nil(obs) +// assert.NotNil(err) +// } + +// // TODO: improve test +// // Simple test that ensures that Update() works +// func TestUpdate(t *testing.T) { +// assert := assert.New(t) + +// now := time.Now() +// // w1 := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: now, +// // Events: []string{"iot", "test"}, +// // }, +// // } +// // w1.Webhook.Config.URL = "http://localhost:9999/foo" +// // w1.Webhook.Config.ContentType = wrp.MimeTypeMsgpack + +// later := time.Now().Add(30 * time.Second) +// // w2 := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: later, +// // Events: []string{"more", "messages"}, +// // }, +// // } +// // w2.Webhook.Config.URL = "http://localhost:9999/foo" +// // w2.Webhook.Config.ContentType = wrp.MimeTypeMsgpack + +// trans := &transport{} +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w1 +// obsf.Sender = doerFunc((&http.Client{}).Do) +// obs, err := obsf.New() +// assert.Nil(err) + +// if _, ok := obs.(*CaduceusOutboundSender); !ok { +// assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") +// } + +// assert.Equal(now, obs.(*CaduceusOutboundSender).deliverUntil, "Delivery should match original value.") +// // obs.Update(w2) +// assert.Equal(later, obs.(*CaduceusOutboundSender).deliverUntil, "Delivery should match new value.") + +// obs.Shutdown(true) +// } + +// // No FailureURL +// func TestOverflowNoFailureURL(t *testing.T) { +// assert := assert.New(t) + +// var output bytes.Buffer +// logger := getNewTestOutputLogger(&output) + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now(), +// // Events: []string{"iot", "test"}, +// // }, +// // } +// // w.Webhook.Config.URL = "http://localhost:9999/foo" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// trans := &transport{} +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w +// obsf.Logger = logger +// obsf.Sender = doerFunc((&http.Client{}).Do) +// obs, err := obsf.New() + +// assert.Nil(err) + +// if _, ok := obs.(*CaduceusOutboundSender); !ok { +// assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") +// } + +// obs.(*CaduceusOutboundSender).queueOverflow() +// assert.NotNil(output.String()) +// } + +// // Valid FailureURL +// func TestOverflowValidFailureURL(t *testing.T) { +// assert := assert.New(t) + +// var output bytes.Buffer +// logger := getNewTestOutputLogger(&output) + +// trans := &transport{} +// trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { +// assert.Equal("POST", req.Method) +// assert.Equal([]string{wrp.MimeTypeJson}, req.Header["Content-Type"]) +// assert.Nil(req.Header["X-Webpa-Signature"]) +// payload, _ := io.ReadAll(req.Body) +// // There is a timestamp in the body, so it's not worth trying to do a string comparison +// assert.NotNil(payload) + +// resp = &http.Response{Status: "200 OK", +// StatusCode: 200, +// } +// return +// } + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now(), +// // FailureURL: "http://localhost:12345/bar", +// // Events: []string{"iot", "test"}, +// // }, +// // } +// // w.Webhook.Config.URL = "http://localhost:9999/foo" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w +// obsf.Logger = logger +// obs, err := obsf.New() +// assert.Nil(err) + +// if _, ok := obs.(*CaduceusOutboundSender); !ok { +// assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") +// } + +// obs.(*CaduceusOutboundSender).queueOverflow() +// assert.NotNil(output.String()) +// } + +// // Valid FailureURL with secret +// func TestOverflowValidFailureURLWithSecret(t *testing.T) { +// assert := assert.New(t) + +// var output bytes.Buffer +// logger := getNewTestOutputLogger(&output) + +// trans := &transport{} +// trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { +// assert.Equal("POST", req.Method) +// assert.Equal([]string{wrp.MimeTypeJson}, req.Header["Content-Type"]) +// // There is a timestamp in the body, so it's not worth trying to do a string comparison +// assert.NotNil(req.Header["X-Webpa-Signature"]) +// payload, _ := io.ReadAll(req.Body) +// assert.NotNil(payload) + +// resp = &http.Response{Status: "200 OK", +// StatusCode: 200, +// } +// return +// } + +// w := ancla.InternalWebhook{ +// Webhook: ancla.Webhook{ +// Until: time.Now(), +// FailureURL: "http://localhost:12345/bar", +// Events: []string{"iot", "test"}, +// }, +// } +// w.Webhook.Config.URL = "http://localhost:9999/foo" +// w.Webhook.Config.ContentType = wrp.MimeTypeJson +// w.Webhook.Config.Secret = "123456" + +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w +// obsf.Logger = logger +// obs, err := obsf.New() +// assert.Nil(err) + +// if _, ok := obs.(*CaduceusOutboundSender); !ok { +// assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") +// } + +// obs.(*CaduceusOutboundSender).queueOverflow() +// assert.NotNil(output.String()) +// } + +// // Valid FailureURL, failed to send, error +// func TestOverflowValidFailureURLError(t *testing.T) { +// assert := assert.New(t) + +// var output bytes.Buffer +// logger := getNewTestOutputLogger(&output) + +// trans := &transport{} +// trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { +// resp = nil +// err = fmt.Errorf("My Error.") +// return +// } + +// // w := ancla.InternalWebhook{ +// // Webhook: ancla.Webhook{ +// // Until: time.Now(), +// // FailureURL: "http://localhost:12345/bar", +// // Events: []string{"iot", "test"}, +// // }, +// // } +// // w.Webhook.Config.URL = "http://localhost:9999/foo" +// // w.Webhook.Config.ContentType = wrp.MimeTypeJson + +// obsf := simpleFactorySetup(trans, time.Second, nil) +// // obsf.Listener = w +// obsf.Logger = logger +// obs, err := obsf.New() +// assert.Nil(err) + +// if _, ok := obs.(*CaduceusOutboundSender); !ok { +// assert.Fail("Interface returned by OutboundSenderFactory.New() must be implemented by a CaduceusOutboundSender.") +// } + +// obs.(*CaduceusOutboundSender).queueOverflow() +// assert.NotNil(output.String()) +// } + +// // Valid Overflow case +// func TestOverflow(t *testing.T) { +// assert := assert.New(t) + +// var output bytes.Buffer +// logger := getNewTestOutputLogger(&output) + +// block := int32(0) +// trans := &transport{} +// trans.fn = func(req *http.Request, count int) (resp *http.Response, err error) { +// if req.URL.String() == "http://localhost:9999/foo" { +// assert.Equal([]string{"01234"}, req.Header["X-Webpa-Transaction-Id"]) + +// // Sleeping until we're told to return +// for 0 == atomic.LoadInt32(&block) { +// time.Sleep(time.Microsecond) +// } +// } + +// resp = &http.Response{Status: "200 OK", +// StatusCode: 200, +// } +// return +// } + +// w := ancla.Webhook{ +// Until: time.Now().Add(30 * time.Second), +// FailureURL: "http://localhost:12345/bar", +// Events: []string{"iot", "test"}, +// } +// w.Config.URL = "http://localhost:9999/foo" +// w.Config.ContentType = wrp.MimeTypeJson + +// obsf := simpleFactorySetup(trans, 4*time.Second, nil) +// obsf.NumWorkers = 1 +// obsf.QueueSize = 2 +// obsf.Logger = logger +// obs, err := obsf.New() +// assert.Nil(err) + +// req := simpleRequest() + +// req.TransactionUUID = "01234" +// obs.Queue(req) +// req.TransactionUUID = "01235" +// obs.Queue(req) + +// // give the worker a chance to pick up one from the queue +// time.Sleep(1 * time.Second) + +// req.TransactionUUID = "01236" +// obs.Queue(req) +// req.TransactionUUID = "01237" +// obs.Queue(req) +// req.TransactionUUID = "01238" +// obs.Queue(req) +// atomic.AddInt32(&block, 1) +// obs.Shutdown(false) + +// assert.NotNil(output.String()) +// }