From 3a302dca422d1bf4deb91b85f0f8c96b95c7625c Mon Sep 17 00:00:00 2001 From: karthick udayakumar Date: Thu, 30 Oct 2025 12:07:55 -0400 Subject: [PATCH] add metron config to use loggregator v2 --- src/code.cloudfoundry.org/go.mod | 2 +- .../integration/fixtures/metron/CA.crl | 16 + .../integration/fixtures/metron/CA.crt | 28 + .../integration/fixtures/metron/CA.key | 51 + .../integration/fixtures/metron/client.crt | 25 + .../integration/fixtures/metron/client.csr | 16 + .../integration/fixtures/metron/client.key | 27 + .../integration/fixtures/metron/metron.crt | 25 + .../integration/fixtures/metron/metron.csr | 16 + .../integration/fixtures/metron/metron.key | 27 + .../internal_api_security_groups_test.go | 51 +- .../testhelpers/fake_ingress_client.go | 1035 +++++++++++++++++ .../testhelpers/fake_ingress_sender_server.go | 478 ++++++++ .../testhelpers/fake_ingress_server.go | 291 +++++ .../testhelpers/ingress_server.go | 93 ++ .../testhelpers/matchers.go | 67 ++ .../testhelpers/package.go | 1 + src/code.cloudfoundry.org/vendor/modules.txt | 1 + 18 files changed, 2239 insertions(+), 11 deletions(-) create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crl create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crt create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.key create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.crt create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.csr create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.key create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.crt create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.csr create mode 100644 src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.key create mode 100644 src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_client.go create mode 100644 src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_sender_server.go create mode 100644 src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_server.go create mode 100644 src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/ingress_server.go create mode 100644 src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/matchers.go create mode 100644 src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/package.go diff --git a/src/code.cloudfoundry.org/go.mod b/src/code.cloudfoundry.org/go.mod index 4c7ac161d..ad88476ec 100644 --- a/src/code.cloudfoundry.org/go.mod +++ b/src/code.cloudfoundry.org/go.mod @@ -13,6 +13,7 @@ require ( code.cloudfoundry.org/cf-networking-helpers v0.63.0 code.cloudfoundry.org/clock v1.53.0 code.cloudfoundry.org/debugserver v0.73.0 + code.cloudfoundry.org/diego-logging-client v0.77.0 code.cloudfoundry.org/filelock v0.49.0 code.cloudfoundry.org/garden v0.0.0-20251029021825-d47b35eadfbb code.cloudfoundry.org/lager/v3 v3.53.0 @@ -52,7 +53,6 @@ require ( ) require ( - code.cloudfoundry.org/diego-logging-client v0.77.0 // indirect code.cloudfoundry.org/durationjson v0.56.0 // indirect code.cloudfoundry.org/go-diodes v0.0.0-20251027221130-fc49a49e17eb // indirect code.cloudfoundry.org/go-log-cache/v3 v3.1.1 // indirect diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crl b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crl new file mode 100644 index 000000000..9610fba65 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crl @@ -0,0 +1,16 @@ +-----BEGIN X509 CRL----- +MIICfDBmAgEBMA0GCSqGSIb3DQEBCwUAMA0xCzAJBgNVBAMTAkNBFw0yNTAzMTIx +OTIxNDZaFw0yNjA5MTIxOTIxNDZaMACgIzAhMB8GA1UdIwQYMBaAFGatVIC9ULEj +vDVDmvFfIReHkT9wMA0GCSqGSIb3DQEBCwUAA4ICAQBKdxDWxUDOhPBPcLfdEs1y +VPSc5wV15Rrd6n5ZSQCSIbKOdZrxYDg/OtS17Ux4g4qfISLNX2/I8Z2AlaD6L3jJ +z073jGW9bOo99N2B8ShNDV704gd8djyUnDAPtsrs3kbR4qlLGxdWVEbCKueUcOZG +QxKp+oRwc6z2LR6KjT9nKL1Kypj2ZP7rBsds87Y7Qua6h/YEgzhWuOX20rA6UI9f +jXcuHuWTXcVHfyK8q7ENIZBkpdSd+2W0SiBuJ2SWq7ya75Bg/wnJeSVEQXAnqkIB +ai3IenmCBca2B8ea2X+yHHU3EurBCmRezi5TpqBuFUSkdyt68qcTlhHeU/EPBPil +r/WaMFUVwLGpMhy5XNnhBy0ZShxxw+XR8/lsYyjc0Qwyb5mCK3NtpxdeDkBKKsCj +aHyxGi6jgrnQv9cDScgbfa3ZfY4h9z6FFntba95sXm4y3g35A6xYF3dBttNSttQP +JuXyinNqIuqB3RGol7jeC6o49Zwlu2oyOiN2ioF4HC4B5sVeRheDeF4oCBzqPTnV +s4FErfnGJM0ceb16UFtzvWCal3FyecAXUwjT/qkTD01ERYYn0WUY2bSWEkBrcB2I +KwfaeR2gI/+cu44P2bnYp7hFJCn5UQrgiWlT7Elu4zMWUmmjBsAMILIHOmzAcXSE +WuDXdYZVKZk/lniujq+TZw== +-----END X509 CRL----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crt b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crt new file mode 100644 index 000000000..54e90b367 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.crt @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIE2jCCAsKgAwIBAgIBATANBgkqhkiG9w0BAQsFADANMQswCQYDVQQDEwJDQTAe +Fw0yNTAzMTIxOTExNDZaFw0yNjA5MTIxOTIxNDZaMA0xCzAJBgNVBA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kpHLqRbCqttcB2E/noucNHTfQZY1QoZKe01bPrLIgs/ +iPEb+KbH8LjaK2n+Ueg8B7oBJnCHnz1uIjSAoge7GXgNNoCb8vW0Vm0drhBSURsT +FAGTMDB+UtmEBhyFNeVJd3Dwv4OjyBPt/+PdbQA3FHM5C+lMCNNpa51tYBguqxLt +p+80cMsj34hbkc5ThLmwrNT3G2jsxAl41TCet8keveKyzoCq1StHoLWpHUaavcEk +948LZkTWoMs/g4xIjXpOKN6wk9Nss97/Ll2SUuUYHyWUZiBt3o3TZC0y5ohpBHeM +8oykM8qx6Ky+G7579HnS0AA9PZNE5pJxSk/MmAVZSF/gihy/joPxcnIqkzZbn7dV +EG7MyDh+3VWNWRC/ZgXZATHlab5V1NPp2fPS1iEWOZ80tXQw2EoNXzGLuC/sIiii +vpvh3ZEnbIgAvP3swuzYcPd3JQiVLgZ9Fhf0MdqoXAeDjmFL/GsZLb1bGZ4Y6Q== +-----END CERTIFICATE----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.key b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.key new file mode 100644 index 000000000..581a08070 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/CA.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKQIBAAKCAgEA2XaluMKh5rB8vyv4v+w6jPh8TZBU9lDzT2L8uPyUOmFgDsvu +aMszmy/5p0z2pnitGa7Gw4qHHs9YHtfwBI6SoCFHvaMs8eK/aM/mP98PosPhnmFW +0H5P/nmkMZV1jK3VvLFDuxPTZORENJSmxTkQRTAI+17NWWivN4KOg5EFLTob230H +boREz0qBBwnCdvxViQg03lMTVqrFEZUluOFQNYa3yrvFfq2uDj0vEkOx2S0r24JU +1UHGgPTP34oNLYDnN3S6JxIc02VUHilyx9RudhVddKdlG8h/3OrRPAyJ1pPeU7xM +TZjkZ6GuuxXnX7XgOxHR5spoGXix1/efOG5vQXetLQ3EtfO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8VJpAC05UjAld +zzfS1TcIUkBBIO05jTshVu4Joo9rnGTyCU8Fo996LDA/85nX6j21vUc+6aBlHVou +sXk3XsUX4rq5kkyZD1/sDeoErQkiV40bz1uUxoQ+5oufVoJrkdfQo/rOnJwHI4bp +uLgEEsiYUnheupqL/QqMqiwFhO13arHULTiSNWDZzj3jOj9BF/7T2cNmoHvqXbhC +7u02M1IMCYqTPlYTZ/655D4xy6prizl8O/OubHNlBsCTAJLr1aG1dfZOIH87nq8F +2JqXJDiR2fOF+IZaGkDRzv22vuclf98X4QKCAQAeIhTD1kTYKcnBv6lWro/7juhT +M6N8l0T8znT8pKpZSxnd6UG6drtXgAzAprMUSxdFq4NwsYtq9M7NZZ8s+brZEzru +NWlHDVpkGEPrt2PGigsygKSrDdt2YErGJR14wFbK41+iLOw8Cs1dWlK3EjdUdfbK +1ig+u31bhVFbCNeWPstPu4GVLTIuO1m3k3OTYI/O+ZAARTPbOYtCN3idBgUZkw/C +7Xyat4oIqQnUugJJv/5QP87Y3C3hukZ9QImkY68lwFdRYO0x4ZWshv2c3AX0b+Rp +LU2ocyc4xFcqi/0ULDEgt/k9GdHFljd1Uk3Y1sAVJMTHR5WT8ynlDjtbLQo1 +-----END RSA PRIVATE KEY----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.crt b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.crt new file mode 100644 index 000000000..ae60f1300 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.crt @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIELjCCAhagAwIBAgIQD9IN+3b0iJ/gvY8e3EjX/DANBgkqhkiG9w0BAQsFADAN +MQswCQYDVQQDEwJDQTAeFw0yNTAzMTIxOTExNDdaFw0yNjA5MTIxOTIxNDVaMBEx +DzANBgNVBAMTBmNsaWVudDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +ANIwrvpkR/cFu2sdZcr2hxP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W8ugh3h +r8acYR0IpIwc61axwaZnp5p9WniJjLFWHUFQQybSLJIBxBGjvuUJbjlutxcDT2eG +UqesH251s3n4q3LC1jUSmOUWrLMVvB7aNA1IvAdcAXL6Mhe5kXjZ6zVu5d0TyUcl +7mNziBINtPvTbzTIXq9Pc8xt +-----END CERTIFICATE----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.csr b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.csr new file mode 100644 index 000000000..ae4cf73f0 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.csr @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICejCCAWICAQAwETEPMA0GA1UEAxMGY2xpZW50MIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEA0jCu+mRH9wW7ax1lyvaHE9R0PtEv4Uzuxfoc8Ng/MBSJ +NaDYh6rVL9aa0SF8pZf4VrJfRopIYYdCEMeCovCcKqJesywtw9iDjsnXWkDVcqTU +cmEFIvS2qION6RD64F4KvBH6d1Byw3w1zy22dpCoLtGnzmtwNWqbnEkU5s1XSvuH +ISQbRpqV218+/Bw36btweAo/3ywmPLFLlO6m4Bj4T5G9/a+jF/ppIi8H1QZGLZ/6 +N1EYQSFBHDQSm0oJuS5Ot573O/TVUubSKDfEhm/OofX5o/hr9Ep8U2jioABwbmNr +zQbOu3s8XX6RjcsJAAFYRYxyVJJg71rEYb74YLoaDQIDAQABoCQwIgYJKoZIhvcN +AQkOMRUwEzARBgNVHREECjAIggZjbGllbnQwDQYJKoZIhvcNAQELBQADggEBAJwt +xyZYX0RPuKiN42zItLD0sj8yURUslONqbLMCwtCCToSmClG4U+Fq3Q8GaTEiGJxd +O3TQnWCU4L1eBZnQesWiuQcWXvnqrYKHnMuDOUwYqGy9aF2C5ICUhdPUhmuK0Tun +F/ikLhH/JAvBWPhy2gD1IcWoUF57IDGw2elDjMEhw5KxCdn9fQxnJyT9r/a39108 +UmGIXszVdE8e2HSFLpDUOHbG7fzpXjc6jYC9KcTPISFsrTqf+UssMzp7PZZG/ZSf +BSqRAVDnJPX3o/jg0c/LH7nwE2J7e/YLPY1VoPKF8/ZIPDXjNnkcZp1islL41gfq +G3JWy0gIel2EuxcVZTE= +-----END CERTIFICATE REQUEST----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.key b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.key new file mode 100644 index 000000000..91ee94846 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/client.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEA0jCu+mRH9wW7ax1lyvaHE9R0PtEv4Uzuxfoc8Ng/MBSJNaDY +h6rVL9aa0SF8pZf4VrJfRopIYYdCEMeCovCcKqJesywtw9iDjsnXWkDVcqTUcmEF +IvS2qION6RD64F4KvBH6d1Byw3w1zy22dpCoLtGnzmtwNWqbnEkU5s1XSvuHISQb +RpqV218+/Bw36btweAo/3ywmPLFLlO6m4Bj4T5G9/a+jF/ppIi8H1QZGLZ/6N1EY +QSFBHDQSm0oJuS5Ot573O/TVUubSKDfEhm/OofX5o/hr9Ep8U2jioABwbmNrzQbO +u3s8XX6RjcsJAAFYRYxyVJJg71rEYb74YLoaDQIDAQABAoIBAQCF7Rsw1AC+ttpK +T/ryLc63peFDvUpCxiBF6S3TkBYC7rLWhtww5Xrc9mLC6hFf+cr0gscOTUH9Uo+X +3Wexppn62GZ6x6WJakW5D4a2LSVT3Q64qnT5Zu+Tw+8CGB2iJIm2d8YdjBbz1Ar9 +LWVbeqSO4GuJrQ9cGcd491/oB+KdFSvRoMuUqzOBUeSbYjaad7LcG5YfDdddZv0U +PTO7WrpboYlbkkNwrN3Lwqa1sRnfYP4f/yM5Nujjl8VkWxu6PnHalFOAlKJAgRRV +jtPEQgi/ce1MFgq/8yR6brmBj+16yvRd7VFyYb4ET6oHVvP44KOjyuQFla3JTguX +KhcbgAOBAoGBAOlyqbUUspBKwNW24E792tqz0dKhSIiRJCMa6Boq7bTol/lWxSmy +IhXuNvbWGdNTsYaU11Xh80uwobLyNKMim+P8BXo7hizLtTtnqidqCSGgnWFnIVS4 +dU8H+SBqp7aRwkAxCM0mMt8MgXMIQSWCQrPedTqBVBwjaFQOrP+kSrfdAoGBAOZ+ +1wMnIuLmR1htl7V+e0/wyXAIioxsYUKlieDzUVxA20Glupm/ym4mLCk4v40TLF+Y +C8Hay5yPjdsE1JzJS48tyUs9kL03yFJt5NGnzIwcopxLxz6H2jOM6nTAy7qeG4E2 +Cvt3d/WygOALiNBaRP8VVIyh6AP9l+WrFR7+SF/xAoGAZJCImwE3iwEo4OfO6Thi +NySPlvTzkiE0OAs3QU6M6Anqrfa7KKMcG+Zqtxq0NV0wdJFZ0h1r+Yc1oSjFlCEs +lqHSmj1aJ6H5iIW3vxLmrB3MrlEHAsATiOAeaeCILxXLYGu/JuD1uTBh83Py3H2o +zmNejL15xkVahBtuWxIjPeECgYAYA6cLIQy1byCHygNAWYknbwLNtVYaA0Cu3Ohc +k30qi2dMk6O5WQ4SI8/+C3eJjzHUU9cFv3HvQdWZuAseuqowpKiQOj3WOPWaAPES +FtVs057tgcekcCr/q/LRbzTKoKZk8+h5Ap1w78QVk54RdxYxLVu9uzCdGdK1jvmI +XR3VQQKBgHezTtDoZGZQGlZJZclLKoBMhMNEkcLlxcIEusLmaYYJRkqPTEhUucGD +1Dc/0w7k4UWkteImHfoiCqB+G54EjVChoc5uS5ADKYaW/18bWxCG789M/bg5Ji8v +sT+rAvhNO5jFNhQ4aen8n8Ev0L2S0zR69d98IgUy8x3Ubhv7mdrR +-----END RSA PRIVATE KEY----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.crt b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.crt new file mode 100644 index 000000000..5508f512e --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/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WvFScP7qK1WAN/7 +dtb6SwwzVurVCBSqp5nOpjtVzwjsdD8kj0eDi2LrkH4WyZl1pRhVM0ch8o1inRSO +Elxyl2d4qE+0Tg+QFAw4QWlRd961td3G5d2ACtnlbljfvh35NdJ0q+fukyXBX6Qk +xV1Mb+wZLV6oGcn5yHBwU0reDKpuYelQzCElsVcCi49eXf812Ct/DWVpVAF1edVj +m0Y+Ls3QVMtCW6LXUmpHMkGP+W4BNA9MjUYKCETErZIntiOyGwu70lpK9brq/Lu/ +nhdwUUqnIFlIwotEhU9EJ9nqgB89UFJIOkxuGKeRKVwWtx1A9fDoIgf5yPLXueKi +UFlJdyL37xaK0ceBSOLOzc6JwcNCsNpJs3maRcZICQ86X2QLsaQMUck5yYe22/I9 +YRaA/pkIGSPtBB1lIiESfvO7 +-----END CERTIFICATE----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.csr b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.csr new file mode 100644 index 000000000..1d7e2ee60 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.csr @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICejCCAWICAQAwETEPMA0GA1UEAxMGbWV0cm9uMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEA1h4fEfrm8VLURPpaqeqIXqv1sIU0LzNHQUwundYIRniP +7gec54pHDHyaY1LKinCa1EiOEgGcI77r7Hrn6jujL4U0+sYJOUMnQZxkgeH5J1pm +t+IHy4rMlo+iVzfN9vcQXtU1dhApLsr4VBlwOR++wyNz5jqH7UpLrLA7OXG/4aMH +09htWIRZKcn8vuQNq1C58/Pt/RwJYRvu3zoK6Slm2wADzaStvO8tjwra4/lFip27 +x0rWmDkhTCypqsQ8QY/+JGZleueJJ5ZiBf+HTrVtDKBsIWHgPLj8+iDatkgvu3kL +co2x/5f6Mfos2pjZ0KHKBa63a1NM5rzjrG6kZv8kcQIDAQABoCQwIgYJKoZIhvcN +AQkOMRUwEzARBgNVHREECjAIggZtZXRyb24wDQYJKoZIhvcNAQELBQADggEBALkF +FipoLqstPkaU3y3OEVKIynBN0bT2UvHzrrmCmu5c+X/5VrlsNdaxSNzRLFdTfW1k +nG55MObSbBK7fUJpJ4lhtBch51SXUGXEfWRjkAeLC2s5Aiwi/jUGy+dBqFww5om4 +CcN9MYjRIHVVvcQuR8qMkuHwPMs5TVY6ErM0x3saLEZwl5qSu052tH2uNMT0m7Uz +9u2R3slQpSwc1lwqhaPvvf5WGk9mhb+NmzUYvFiV+hxViB+Ok7DnG6N25o1wIYSE +xkU+yr+I05v2qAMaAAwtuzurWJjCm0swaxSsyHSMmrVHjSQnSHCPm+tszvi912xM +bthBnu8Job78UOOFGtM= +-----END CERTIFICATE REQUEST----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.key b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.key new file mode 100644 index 000000000..2e0f3b3f3 --- /dev/null +++ b/src/code.cloudfoundry.org/policy-server/integration/fixtures/metron/metron.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA1h4fEfrm8VLURPpaqeqIXqv1sIU0LzNHQUwundYIRniP7gec +54pHDHyaY1LKinCa1EiOEgGcI77r7Hrn6jujL4U0+sYJOUMnQZxkgeH5J1pmt+IH +y4rMlo+iVzfN9vcQXtU1dhApLsr4VBlwOR++wyNz5jqH7UpLrLA7OXG/4aMH09ht +WIRZKcn8vuQNq1C58/Pt/RwJYRvu3zoK6Slm2wADzaStvO8tjwra4/lFip27x0rW +mDkhTCypqsQ8QY/+JGZleueJJ5ZiBf+HTrVtDKBsIWHgPLj8+iDatkgvu3kLco2x +/5f6Mfos2pjZ0KHKBa63a1NM5rzjrG6kZv8kcQIDAQABAoIBAQCDUaH4owr0wroR +PAJS59aPSaO7iVaCBE8VSyXkA5q7rcGIWP7wOqxsihceB27VDU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ZOqlx9scPXIZCIzh00zqg2RZf20ykzPq6 +UM3hjrsIq6V/2HBQpzz1rs4NQwUCDpjfDLkaUt/TUBbiMr4JcI77oA== +-----END RSA PRIVATE KEY----- diff --git a/src/code.cloudfoundry.org/policy-server/integration/internal_api_security_groups_test.go b/src/code.cloudfoundry.org/policy-server/integration/internal_api_security_groups_test.go index f7d14c123..b9b5b1494 100644 --- a/src/code.cloudfoundry.org/policy-server/integration/internal_api_security_groups_test.go +++ b/src/code.cloudfoundry.org/policy-server/integration/internal_api_security_groups_test.go @@ -6,12 +6,15 @@ import ( "fmt" "io" "net/http" + "path/filepath" "time" "code.cloudfoundry.org/cf-networking-helpers/db" "code.cloudfoundry.org/cf-networking-helpers/testsupport" "code.cloudfoundry.org/cf-networking-helpers/testsupport/metrics" "code.cloudfoundry.org/cf-networking-helpers/testsupport/ports" + loggingclient "code.cloudfoundry.org/diego-logging-client" + logginghelper "code.cloudfoundry.org/diego-logging-client/testhelpers" locketconfig "code.cloudfoundry.org/locket/cmd/locket/config" lockettestrunner "code.cloudfoundry.org/locket/cmd/locket/testrunner" "code.cloudfoundry.org/policy-server/api" @@ -19,6 +22,7 @@ import ( "code.cloudfoundry.org/policy-server/config" "code.cloudfoundry.org/policy-server/integration/helpers" testhelpers "code.cloudfoundry.org/test-helpers" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" @@ -28,22 +32,40 @@ import ( var _ = Describe("Internal API Listing security groups", func() { var ( - sessions []*gexec.Session - asgSyncerSession *gexec.Session - asgSyncerConfig config.ASGSyncerConfig - tlsConfig *tls.Config - policyServerConfs []config.Config - policyServerInternalConfs []config.InternalConfig - internalConf config.InternalConfig - dbConf db.Config - locketDBConf db.Config - locketProcess ifrit.Process + sessions []*gexec.Session + asgSyncerSession *gexec.Session + asgSyncerConfig config.ASGSyncerConfig + tlsConfig *tls.Config + policyServerConfs []config.Config + policyServerInternalConfs []config.InternalConfig + internalConf config.InternalConfig + dbConf db.Config + locketDBConf db.Config + locketProcess ifrit.Process + signalMetricsChan chan struct{} + testIngressServer *logginghelper.TestIngressServer + metronCAFile, metronServerCertFile, metronServerKeyFile string fakeMetron metrics.FakeMetron mockCCServer *helpers.ConfigurableMockCCServer ) BeforeEach(func() { + fixturesPath := "fixtures" + + var err error + metronCAFile = filepath.Join(fixturesPath, "metron", "CA.crt") + metronServerCertFile = filepath.Join(fixturesPath, "metron", "metron.crt") + metronServerKeyFile = filepath.Join(fixturesPath, "metron", "metron.key") + testIngressServer, err = logginghelper.NewTestIngressServer(metronServerCertFile, metronServerKeyFile, metronCAFile) + Expect(err).NotTo(HaveOccurred()) + + receiversChan := testIngressServer.Receivers() + testIngressServer.Start() + + _, signalMetricsChan = logginghelper.TestMetricChan(receiversChan) + metricsPort, _ := testIngressServer.Port() + fakeMetron = metrics.NewFakeMetron() dbConf = testsupport.GetDBConfig() @@ -108,6 +130,12 @@ var _ = Describe("Internal API Listing security groups", func() { cfg.ListenAddress = locketAddress cfg.DatabaseDriver = dbConf.Type cfg.DatabaseConnectionString = locketDBConnectionString + cfg.LoggregatorConfig = loggingclient.Config{ + APIPort: metricsPort, + CACertPath: metronCAFile, + CertPath: metronServerCertFile, + KeyPath: metronServerKeyFile, + } }) locketProcess = ifrit.Invoke(locketRunner) @@ -140,6 +168,9 @@ var _ = Describe("Internal API Listing security groups", func() { fakeMetron.Close() ginkgomon.Interrupt(locketProcess, 5*time.Second) testhelpers.RemoveDatabase(locketDBConf) + + testIngressServer.Stop() + close(signalMetricsChan) }) Describe("listing security groups", func() { diff --git a/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_client.go b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_client.go new file mode 100644 index 000000000..f4c5db01c --- /dev/null +++ b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_client.go @@ -0,0 +1,1035 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package testhelpers + +import ( + "sync" + "time" + + diego_logging_client "code.cloudfoundry.org/diego-logging-client" + loggregator "code.cloudfoundry.org/go-loggregator/v9" +) + +type FakeIngressClient struct { + IncrementCounterStub func(string) error + incrementCounterMutex sync.RWMutex + incrementCounterArgsForCall []struct { + arg1 string + } + incrementCounterReturns struct { + result1 error + } + incrementCounterReturnsOnCall map[int]struct { + result1 error + } + IncrementCounterWithDeltaStub func(string, uint64) error + incrementCounterWithDeltaMutex sync.RWMutex + incrementCounterWithDeltaArgsForCall []struct { + arg1 string + arg2 uint64 + } + incrementCounterWithDeltaReturns struct { + result1 error + } + incrementCounterWithDeltaReturnsOnCall map[int]struct { + result1 error + } + SendAppErrorLogStub func(string, string, map[string]string) error + sendAppErrorLogMutex sync.RWMutex + sendAppErrorLogArgsForCall []struct { + arg1 string + arg2 string + arg3 map[string]string + } + sendAppErrorLogReturns struct { + result1 error + } + sendAppErrorLogReturnsOnCall map[int]struct { + result1 error + } + SendAppLogStub func(string, string, map[string]string) error + sendAppLogMutex sync.RWMutex + sendAppLogArgsForCall []struct { + arg1 string + arg2 string + arg3 map[string]string + } + sendAppLogReturns struct { + result1 error + } + sendAppLogReturnsOnCall map[int]struct { + result1 error + } + SendAppLogRateStub func(float64, float64, map[string]string) error + sendAppLogRateMutex sync.RWMutex + sendAppLogRateArgsForCall []struct { + arg1 float64 + arg2 float64 + arg3 map[string]string + } + sendAppLogRateReturns struct { + result1 error + } + sendAppLogRateReturnsOnCall map[int]struct { + result1 error + } + SendAppMetricsStub func(diego_logging_client.ContainerMetric) error + sendAppMetricsMutex sync.RWMutex + sendAppMetricsArgsForCall []struct { + arg1 diego_logging_client.ContainerMetric + } + sendAppMetricsReturns struct { + result1 error + } + sendAppMetricsReturnsOnCall map[int]struct { + result1 error + } + SendBytesPerSecondStub func(string, float64) error + sendBytesPerSecondMutex sync.RWMutex + sendBytesPerSecondArgsForCall []struct { + arg1 string + arg2 float64 + } + sendBytesPerSecondReturns struct { + result1 error + } + sendBytesPerSecondReturnsOnCall map[int]struct { + result1 error + } + SendComponentMetricStub func(string, float64, string) error + sendComponentMetricMutex sync.RWMutex + sendComponentMetricArgsForCall []struct { + arg1 string + arg2 float64 + arg3 string + } + sendComponentMetricReturns struct { + result1 error + } + sendComponentMetricReturnsOnCall map[int]struct { + result1 error + } + SendDurationStub func(string, time.Duration, ...loggregator.EmitGaugeOption) error + sendDurationMutex sync.RWMutex + sendDurationArgsForCall []struct { + arg1 string + arg2 time.Duration + arg3 []loggregator.EmitGaugeOption + } + sendDurationReturns struct { + result1 error + } + sendDurationReturnsOnCall map[int]struct { + result1 error + } + SendMebiBytesStub func(string, int, ...loggregator.EmitGaugeOption) error + sendMebiBytesMutex sync.RWMutex + sendMebiBytesArgsForCall []struct { + arg1 string + arg2 int + arg3 []loggregator.EmitGaugeOption + } + sendMebiBytesReturns struct { + result1 error + } + sendMebiBytesReturnsOnCall map[int]struct { + result1 error + } + SendMetricStub func(string, int, ...loggregator.EmitGaugeOption) error + sendMetricMutex sync.RWMutex + sendMetricArgsForCall []struct { + arg1 string + arg2 int + arg3 []loggregator.EmitGaugeOption + } + sendMetricReturns struct { + result1 error + } + sendMetricReturnsOnCall map[int]struct { + result1 error + } + SendRequestsPerSecondStub func(string, float64) error + sendRequestsPerSecondMutex sync.RWMutex + sendRequestsPerSecondArgsForCall []struct { + arg1 string + arg2 float64 + } + sendRequestsPerSecondReturns struct { + result1 error + } + sendRequestsPerSecondReturnsOnCall map[int]struct { + result1 error + } + SendSpikeMetricsStub func(diego_logging_client.SpikeMetric) error + sendSpikeMetricsMutex sync.RWMutex + sendSpikeMetricsArgsForCall []struct { + arg1 diego_logging_client.SpikeMetric + } + sendSpikeMetricsReturns struct { + result1 error + } + sendSpikeMetricsReturnsOnCall map[int]struct { + result1 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeIngressClient) IncrementCounter(arg1 string) error { + fake.incrementCounterMutex.Lock() + ret, specificReturn := fake.incrementCounterReturnsOnCall[len(fake.incrementCounterArgsForCall)] + fake.incrementCounterArgsForCall = append(fake.incrementCounterArgsForCall, struct { + arg1 string + }{arg1}) + stub := fake.IncrementCounterStub + fakeReturns := fake.incrementCounterReturns + fake.recordInvocation("IncrementCounter", []interface{}{arg1}) + fake.incrementCounterMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) IncrementCounterCallCount() int { + fake.incrementCounterMutex.RLock() + defer fake.incrementCounterMutex.RUnlock() + return len(fake.incrementCounterArgsForCall) +} + +func (fake *FakeIngressClient) IncrementCounterCalls(stub func(string) error) { + fake.incrementCounterMutex.Lock() + defer fake.incrementCounterMutex.Unlock() + fake.IncrementCounterStub = stub +} + +func (fake *FakeIngressClient) IncrementCounterArgsForCall(i int) string { + fake.incrementCounterMutex.RLock() + defer fake.incrementCounterMutex.RUnlock() + argsForCall := fake.incrementCounterArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeIngressClient) IncrementCounterReturns(result1 error) { + fake.incrementCounterMutex.Lock() + defer fake.incrementCounterMutex.Unlock() + fake.IncrementCounterStub = nil + fake.incrementCounterReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) IncrementCounterReturnsOnCall(i int, result1 error) { + fake.incrementCounterMutex.Lock() + defer fake.incrementCounterMutex.Unlock() + fake.IncrementCounterStub = nil + if fake.incrementCounterReturnsOnCall == nil { + fake.incrementCounterReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.incrementCounterReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) IncrementCounterWithDelta(arg1 string, arg2 uint64) error { + fake.incrementCounterWithDeltaMutex.Lock() + ret, specificReturn := fake.incrementCounterWithDeltaReturnsOnCall[len(fake.incrementCounterWithDeltaArgsForCall)] + fake.incrementCounterWithDeltaArgsForCall = append(fake.incrementCounterWithDeltaArgsForCall, struct { + arg1 string + arg2 uint64 + }{arg1, arg2}) + stub := fake.IncrementCounterWithDeltaStub + fakeReturns := fake.incrementCounterWithDeltaReturns + fake.recordInvocation("IncrementCounterWithDelta", []interface{}{arg1, arg2}) + fake.incrementCounterWithDeltaMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) IncrementCounterWithDeltaCallCount() int { + fake.incrementCounterWithDeltaMutex.RLock() + defer fake.incrementCounterWithDeltaMutex.RUnlock() + return len(fake.incrementCounterWithDeltaArgsForCall) +} + +func (fake *FakeIngressClient) IncrementCounterWithDeltaCalls(stub func(string, uint64) error) { + fake.incrementCounterWithDeltaMutex.Lock() + defer fake.incrementCounterWithDeltaMutex.Unlock() + fake.IncrementCounterWithDeltaStub = stub +} + +func (fake *FakeIngressClient) IncrementCounterWithDeltaArgsForCall(i int) (string, uint64) { + fake.incrementCounterWithDeltaMutex.RLock() + defer fake.incrementCounterWithDeltaMutex.RUnlock() + argsForCall := fake.incrementCounterWithDeltaArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeIngressClient) IncrementCounterWithDeltaReturns(result1 error) { + fake.incrementCounterWithDeltaMutex.Lock() + defer fake.incrementCounterWithDeltaMutex.Unlock() + fake.IncrementCounterWithDeltaStub = nil + fake.incrementCounterWithDeltaReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) IncrementCounterWithDeltaReturnsOnCall(i int, result1 error) { + fake.incrementCounterWithDeltaMutex.Lock() + defer fake.incrementCounterWithDeltaMutex.Unlock() + fake.IncrementCounterWithDeltaStub = nil + if fake.incrementCounterWithDeltaReturnsOnCall == nil { + fake.incrementCounterWithDeltaReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.incrementCounterWithDeltaReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppErrorLog(arg1 string, arg2 string, arg3 map[string]string) error { + fake.sendAppErrorLogMutex.Lock() + ret, specificReturn := fake.sendAppErrorLogReturnsOnCall[len(fake.sendAppErrorLogArgsForCall)] + fake.sendAppErrorLogArgsForCall = append(fake.sendAppErrorLogArgsForCall, struct { + arg1 string + arg2 string + arg3 map[string]string + }{arg1, arg2, arg3}) + stub := fake.SendAppErrorLogStub + fakeReturns := fake.sendAppErrorLogReturns + fake.recordInvocation("SendAppErrorLog", []interface{}{arg1, arg2, arg3}) + fake.sendAppErrorLogMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendAppErrorLogCallCount() int { + fake.sendAppErrorLogMutex.RLock() + defer fake.sendAppErrorLogMutex.RUnlock() + return len(fake.sendAppErrorLogArgsForCall) +} + +func (fake *FakeIngressClient) SendAppErrorLogCalls(stub func(string, string, map[string]string) error) { + fake.sendAppErrorLogMutex.Lock() + defer fake.sendAppErrorLogMutex.Unlock() + fake.SendAppErrorLogStub = stub +} + +func (fake *FakeIngressClient) SendAppErrorLogArgsForCall(i int) (string, string, map[string]string) { + fake.sendAppErrorLogMutex.RLock() + defer fake.sendAppErrorLogMutex.RUnlock() + argsForCall := fake.sendAppErrorLogArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIngressClient) SendAppErrorLogReturns(result1 error) { + fake.sendAppErrorLogMutex.Lock() + defer fake.sendAppErrorLogMutex.Unlock() + fake.SendAppErrorLogStub = nil + fake.sendAppErrorLogReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppErrorLogReturnsOnCall(i int, result1 error) { + fake.sendAppErrorLogMutex.Lock() + defer fake.sendAppErrorLogMutex.Unlock() + fake.SendAppErrorLogStub = nil + if fake.sendAppErrorLogReturnsOnCall == nil { + fake.sendAppErrorLogReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendAppErrorLogReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppLog(arg1 string, arg2 string, arg3 map[string]string) error { + fake.sendAppLogMutex.Lock() + ret, specificReturn := fake.sendAppLogReturnsOnCall[len(fake.sendAppLogArgsForCall)] + fake.sendAppLogArgsForCall = append(fake.sendAppLogArgsForCall, struct { + arg1 string + arg2 string + arg3 map[string]string + }{arg1, arg2, arg3}) + stub := fake.SendAppLogStub + fakeReturns := fake.sendAppLogReturns + fake.recordInvocation("SendAppLog", []interface{}{arg1, arg2, arg3}) + fake.sendAppLogMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendAppLogCallCount() int { + fake.sendAppLogMutex.RLock() + defer fake.sendAppLogMutex.RUnlock() + return len(fake.sendAppLogArgsForCall) +} + +func (fake *FakeIngressClient) SendAppLogCalls(stub func(string, string, map[string]string) error) { + fake.sendAppLogMutex.Lock() + defer fake.sendAppLogMutex.Unlock() + fake.SendAppLogStub = stub +} + +func (fake *FakeIngressClient) SendAppLogArgsForCall(i int) (string, string, map[string]string) { + fake.sendAppLogMutex.RLock() + defer fake.sendAppLogMutex.RUnlock() + argsForCall := fake.sendAppLogArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIngressClient) SendAppLogReturns(result1 error) { + fake.sendAppLogMutex.Lock() + defer fake.sendAppLogMutex.Unlock() + fake.SendAppLogStub = nil + fake.sendAppLogReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppLogReturnsOnCall(i int, result1 error) { + fake.sendAppLogMutex.Lock() + defer fake.sendAppLogMutex.Unlock() + fake.SendAppLogStub = nil + if fake.sendAppLogReturnsOnCall == nil { + fake.sendAppLogReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendAppLogReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppLogRate(arg1 float64, arg2 float64, arg3 map[string]string) error { + fake.sendAppLogRateMutex.Lock() + ret, specificReturn := fake.sendAppLogRateReturnsOnCall[len(fake.sendAppLogRateArgsForCall)] + fake.sendAppLogRateArgsForCall = append(fake.sendAppLogRateArgsForCall, struct { + arg1 float64 + arg2 float64 + arg3 map[string]string + }{arg1, arg2, arg3}) + stub := fake.SendAppLogRateStub + fakeReturns := fake.sendAppLogRateReturns + fake.recordInvocation("SendAppLogRate", []interface{}{arg1, arg2, arg3}) + fake.sendAppLogRateMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendAppLogRateCallCount() int { + fake.sendAppLogRateMutex.RLock() + defer fake.sendAppLogRateMutex.RUnlock() + return len(fake.sendAppLogRateArgsForCall) +} + +func (fake *FakeIngressClient) SendAppLogRateCalls(stub func(float64, float64, map[string]string) error) { + fake.sendAppLogRateMutex.Lock() + defer fake.sendAppLogRateMutex.Unlock() + fake.SendAppLogRateStub = stub +} + +func (fake *FakeIngressClient) SendAppLogRateArgsForCall(i int) (float64, float64, map[string]string) { + fake.sendAppLogRateMutex.RLock() + defer fake.sendAppLogRateMutex.RUnlock() + argsForCall := fake.sendAppLogRateArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIngressClient) SendAppLogRateReturns(result1 error) { + fake.sendAppLogRateMutex.Lock() + defer fake.sendAppLogRateMutex.Unlock() + fake.SendAppLogRateStub = nil + fake.sendAppLogRateReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppLogRateReturnsOnCall(i int, result1 error) { + fake.sendAppLogRateMutex.Lock() + defer fake.sendAppLogRateMutex.Unlock() + fake.SendAppLogRateStub = nil + if fake.sendAppLogRateReturnsOnCall == nil { + fake.sendAppLogRateReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendAppLogRateReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppMetrics(arg1 diego_logging_client.ContainerMetric) error { + fake.sendAppMetricsMutex.Lock() + ret, specificReturn := fake.sendAppMetricsReturnsOnCall[len(fake.sendAppMetricsArgsForCall)] + fake.sendAppMetricsArgsForCall = append(fake.sendAppMetricsArgsForCall, struct { + arg1 diego_logging_client.ContainerMetric + }{arg1}) + stub := fake.SendAppMetricsStub + fakeReturns := fake.sendAppMetricsReturns + fake.recordInvocation("SendAppMetrics", []interface{}{arg1}) + fake.sendAppMetricsMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendAppMetricsCallCount() int { + fake.sendAppMetricsMutex.RLock() + defer fake.sendAppMetricsMutex.RUnlock() + return len(fake.sendAppMetricsArgsForCall) +} + +func (fake *FakeIngressClient) SendAppMetricsCalls(stub func(diego_logging_client.ContainerMetric) error) { + fake.sendAppMetricsMutex.Lock() + defer fake.sendAppMetricsMutex.Unlock() + fake.SendAppMetricsStub = stub +} + +func (fake *FakeIngressClient) SendAppMetricsArgsForCall(i int) diego_logging_client.ContainerMetric { + fake.sendAppMetricsMutex.RLock() + defer fake.sendAppMetricsMutex.RUnlock() + argsForCall := fake.sendAppMetricsArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeIngressClient) SendAppMetricsReturns(result1 error) { + fake.sendAppMetricsMutex.Lock() + defer fake.sendAppMetricsMutex.Unlock() + fake.SendAppMetricsStub = nil + fake.sendAppMetricsReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendAppMetricsReturnsOnCall(i int, result1 error) { + fake.sendAppMetricsMutex.Lock() + defer fake.sendAppMetricsMutex.Unlock() + fake.SendAppMetricsStub = nil + if fake.sendAppMetricsReturnsOnCall == nil { + fake.sendAppMetricsReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendAppMetricsReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendBytesPerSecond(arg1 string, arg2 float64) error { + fake.sendBytesPerSecondMutex.Lock() + ret, specificReturn := fake.sendBytesPerSecondReturnsOnCall[len(fake.sendBytesPerSecondArgsForCall)] + fake.sendBytesPerSecondArgsForCall = append(fake.sendBytesPerSecondArgsForCall, struct { + arg1 string + arg2 float64 + }{arg1, arg2}) + stub := fake.SendBytesPerSecondStub + fakeReturns := fake.sendBytesPerSecondReturns + fake.recordInvocation("SendBytesPerSecond", []interface{}{arg1, arg2}) + fake.sendBytesPerSecondMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendBytesPerSecondCallCount() int { + fake.sendBytesPerSecondMutex.RLock() + defer fake.sendBytesPerSecondMutex.RUnlock() + return len(fake.sendBytesPerSecondArgsForCall) +} + +func (fake *FakeIngressClient) SendBytesPerSecondCalls(stub func(string, float64) error) { + fake.sendBytesPerSecondMutex.Lock() + defer fake.sendBytesPerSecondMutex.Unlock() + fake.SendBytesPerSecondStub = stub +} + +func (fake *FakeIngressClient) SendBytesPerSecondArgsForCall(i int) (string, float64) { + fake.sendBytesPerSecondMutex.RLock() + defer fake.sendBytesPerSecondMutex.RUnlock() + argsForCall := fake.sendBytesPerSecondArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeIngressClient) SendBytesPerSecondReturns(result1 error) { + fake.sendBytesPerSecondMutex.Lock() + defer fake.sendBytesPerSecondMutex.Unlock() + fake.SendBytesPerSecondStub = nil + fake.sendBytesPerSecondReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendBytesPerSecondReturnsOnCall(i int, result1 error) { + fake.sendBytesPerSecondMutex.Lock() + defer fake.sendBytesPerSecondMutex.Unlock() + fake.SendBytesPerSecondStub = nil + if fake.sendBytesPerSecondReturnsOnCall == nil { + fake.sendBytesPerSecondReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendBytesPerSecondReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendComponentMetric(arg1 string, arg2 float64, arg3 string) error { + fake.sendComponentMetricMutex.Lock() + ret, specificReturn := fake.sendComponentMetricReturnsOnCall[len(fake.sendComponentMetricArgsForCall)] + fake.sendComponentMetricArgsForCall = append(fake.sendComponentMetricArgsForCall, struct { + arg1 string + arg2 float64 + arg3 string + }{arg1, arg2, arg3}) + stub := fake.SendComponentMetricStub + fakeReturns := fake.sendComponentMetricReturns + fake.recordInvocation("SendComponentMetric", []interface{}{arg1, arg2, arg3}) + fake.sendComponentMetricMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendComponentMetricCallCount() int { + fake.sendComponentMetricMutex.RLock() + defer fake.sendComponentMetricMutex.RUnlock() + return len(fake.sendComponentMetricArgsForCall) +} + +func (fake *FakeIngressClient) SendComponentMetricCalls(stub func(string, float64, string) error) { + fake.sendComponentMetricMutex.Lock() + defer fake.sendComponentMetricMutex.Unlock() + fake.SendComponentMetricStub = stub +} + +func (fake *FakeIngressClient) SendComponentMetricArgsForCall(i int) (string, float64, string) { + fake.sendComponentMetricMutex.RLock() + defer fake.sendComponentMetricMutex.RUnlock() + argsForCall := fake.sendComponentMetricArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIngressClient) SendComponentMetricReturns(result1 error) { + fake.sendComponentMetricMutex.Lock() + defer fake.sendComponentMetricMutex.Unlock() + fake.SendComponentMetricStub = nil + fake.sendComponentMetricReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendComponentMetricReturnsOnCall(i int, result1 error) { + fake.sendComponentMetricMutex.Lock() + defer fake.sendComponentMetricMutex.Unlock() + fake.SendComponentMetricStub = nil + if fake.sendComponentMetricReturnsOnCall == nil { + fake.sendComponentMetricReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendComponentMetricReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendDuration(arg1 string, arg2 time.Duration, arg3 ...loggregator.EmitGaugeOption) error { + fake.sendDurationMutex.Lock() + ret, specificReturn := fake.sendDurationReturnsOnCall[len(fake.sendDurationArgsForCall)] + fake.sendDurationArgsForCall = append(fake.sendDurationArgsForCall, struct { + arg1 string + arg2 time.Duration + arg3 []loggregator.EmitGaugeOption + }{arg1, arg2, arg3}) + stub := fake.SendDurationStub + fakeReturns := fake.sendDurationReturns + fake.recordInvocation("SendDuration", []interface{}{arg1, arg2, arg3}) + fake.sendDurationMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3...) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendDurationCallCount() int { + fake.sendDurationMutex.RLock() + defer fake.sendDurationMutex.RUnlock() + return len(fake.sendDurationArgsForCall) +} + +func (fake *FakeIngressClient) SendDurationCalls(stub func(string, time.Duration, ...loggregator.EmitGaugeOption) error) { + fake.sendDurationMutex.Lock() + defer fake.sendDurationMutex.Unlock() + fake.SendDurationStub = stub +} + +func (fake *FakeIngressClient) SendDurationArgsForCall(i int) (string, time.Duration, []loggregator.EmitGaugeOption) { + fake.sendDurationMutex.RLock() + defer fake.sendDurationMutex.RUnlock() + argsForCall := fake.sendDurationArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIngressClient) SendDurationReturns(result1 error) { + fake.sendDurationMutex.Lock() + defer fake.sendDurationMutex.Unlock() + fake.SendDurationStub = nil + fake.sendDurationReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendDurationReturnsOnCall(i int, result1 error) { + fake.sendDurationMutex.Lock() + defer fake.sendDurationMutex.Unlock() + fake.SendDurationStub = nil + if fake.sendDurationReturnsOnCall == nil { + fake.sendDurationReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendDurationReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendMebiBytes(arg1 string, arg2 int, arg3 ...loggregator.EmitGaugeOption) error { + fake.sendMebiBytesMutex.Lock() + ret, specificReturn := fake.sendMebiBytesReturnsOnCall[len(fake.sendMebiBytesArgsForCall)] + fake.sendMebiBytesArgsForCall = append(fake.sendMebiBytesArgsForCall, struct { + arg1 string + arg2 int + arg3 []loggregator.EmitGaugeOption + }{arg1, arg2, arg3}) + stub := fake.SendMebiBytesStub + fakeReturns := fake.sendMebiBytesReturns + fake.recordInvocation("SendMebiBytes", []interface{}{arg1, arg2, arg3}) + fake.sendMebiBytesMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3...) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendMebiBytesCallCount() int { + fake.sendMebiBytesMutex.RLock() + defer fake.sendMebiBytesMutex.RUnlock() + return len(fake.sendMebiBytesArgsForCall) +} + +func (fake *FakeIngressClient) SendMebiBytesCalls(stub func(string, int, ...loggregator.EmitGaugeOption) error) { + fake.sendMebiBytesMutex.Lock() + defer fake.sendMebiBytesMutex.Unlock() + fake.SendMebiBytesStub = stub +} + +func (fake *FakeIngressClient) SendMebiBytesArgsForCall(i int) (string, int, []loggregator.EmitGaugeOption) { + fake.sendMebiBytesMutex.RLock() + defer fake.sendMebiBytesMutex.RUnlock() + argsForCall := fake.sendMebiBytesArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIngressClient) SendMebiBytesReturns(result1 error) { + fake.sendMebiBytesMutex.Lock() + defer fake.sendMebiBytesMutex.Unlock() + fake.SendMebiBytesStub = nil + fake.sendMebiBytesReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendMebiBytesReturnsOnCall(i int, result1 error) { + fake.sendMebiBytesMutex.Lock() + defer fake.sendMebiBytesMutex.Unlock() + fake.SendMebiBytesStub = nil + if fake.sendMebiBytesReturnsOnCall == nil { + fake.sendMebiBytesReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendMebiBytesReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendMetric(arg1 string, arg2 int, arg3 ...loggregator.EmitGaugeOption) error { + fake.sendMetricMutex.Lock() + ret, specificReturn := fake.sendMetricReturnsOnCall[len(fake.sendMetricArgsForCall)] + fake.sendMetricArgsForCall = append(fake.sendMetricArgsForCall, struct { + arg1 string + arg2 int + arg3 []loggregator.EmitGaugeOption + }{arg1, arg2, arg3}) + stub := fake.SendMetricStub + fakeReturns := fake.sendMetricReturns + fake.recordInvocation("SendMetric", []interface{}{arg1, arg2, arg3}) + fake.sendMetricMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3...) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendMetricCallCount() int { + fake.sendMetricMutex.RLock() + defer fake.sendMetricMutex.RUnlock() + return len(fake.sendMetricArgsForCall) +} + +func (fake *FakeIngressClient) SendMetricCalls(stub func(string, int, ...loggregator.EmitGaugeOption) error) { + fake.sendMetricMutex.Lock() + defer fake.sendMetricMutex.Unlock() + fake.SendMetricStub = stub +} + +func (fake *FakeIngressClient) SendMetricArgsForCall(i int) (string, int, []loggregator.EmitGaugeOption) { + fake.sendMetricMutex.RLock() + defer fake.sendMetricMutex.RUnlock() + argsForCall := fake.sendMetricArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 +} + +func (fake *FakeIngressClient) SendMetricReturns(result1 error) { + fake.sendMetricMutex.Lock() + defer fake.sendMetricMutex.Unlock() + fake.SendMetricStub = nil + fake.sendMetricReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendMetricReturnsOnCall(i int, result1 error) { + fake.sendMetricMutex.Lock() + defer fake.sendMetricMutex.Unlock() + fake.SendMetricStub = nil + if fake.sendMetricReturnsOnCall == nil { + fake.sendMetricReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendMetricReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendRequestsPerSecond(arg1 string, arg2 float64) error { + fake.sendRequestsPerSecondMutex.Lock() + ret, specificReturn := fake.sendRequestsPerSecondReturnsOnCall[len(fake.sendRequestsPerSecondArgsForCall)] + fake.sendRequestsPerSecondArgsForCall = append(fake.sendRequestsPerSecondArgsForCall, struct { + arg1 string + arg2 float64 + }{arg1, arg2}) + stub := fake.SendRequestsPerSecondStub + fakeReturns := fake.sendRequestsPerSecondReturns + fake.recordInvocation("SendRequestsPerSecond", []interface{}{arg1, arg2}) + fake.sendRequestsPerSecondMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendRequestsPerSecondCallCount() int { + fake.sendRequestsPerSecondMutex.RLock() + defer fake.sendRequestsPerSecondMutex.RUnlock() + return len(fake.sendRequestsPerSecondArgsForCall) +} + +func (fake *FakeIngressClient) SendRequestsPerSecondCalls(stub func(string, float64) error) { + fake.sendRequestsPerSecondMutex.Lock() + defer fake.sendRequestsPerSecondMutex.Unlock() + fake.SendRequestsPerSecondStub = stub +} + +func (fake *FakeIngressClient) SendRequestsPerSecondArgsForCall(i int) (string, float64) { + fake.sendRequestsPerSecondMutex.RLock() + defer fake.sendRequestsPerSecondMutex.RUnlock() + argsForCall := fake.sendRequestsPerSecondArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeIngressClient) SendRequestsPerSecondReturns(result1 error) { + fake.sendRequestsPerSecondMutex.Lock() + defer fake.sendRequestsPerSecondMutex.Unlock() + fake.SendRequestsPerSecondStub = nil + fake.sendRequestsPerSecondReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendRequestsPerSecondReturnsOnCall(i int, result1 error) { + fake.sendRequestsPerSecondMutex.Lock() + defer fake.sendRequestsPerSecondMutex.Unlock() + fake.SendRequestsPerSecondStub = nil + if fake.sendRequestsPerSecondReturnsOnCall == nil { + fake.sendRequestsPerSecondReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendRequestsPerSecondReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendSpikeMetrics(arg1 diego_logging_client.SpikeMetric) error { + fake.sendSpikeMetricsMutex.Lock() + ret, specificReturn := fake.sendSpikeMetricsReturnsOnCall[len(fake.sendSpikeMetricsArgsForCall)] + fake.sendSpikeMetricsArgsForCall = append(fake.sendSpikeMetricsArgsForCall, struct { + arg1 diego_logging_client.SpikeMetric + }{arg1}) + stub := fake.SendSpikeMetricsStub + fakeReturns := fake.sendSpikeMetricsReturns + fake.recordInvocation("SendSpikeMetrics", []interface{}{arg1}) + fake.sendSpikeMetricsMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressClient) SendSpikeMetricsCallCount() int { + fake.sendSpikeMetricsMutex.RLock() + defer fake.sendSpikeMetricsMutex.RUnlock() + return len(fake.sendSpikeMetricsArgsForCall) +} + +func (fake *FakeIngressClient) SendSpikeMetricsCalls(stub func(diego_logging_client.SpikeMetric) error) { + fake.sendSpikeMetricsMutex.Lock() + defer fake.sendSpikeMetricsMutex.Unlock() + fake.SendSpikeMetricsStub = stub +} + +func (fake *FakeIngressClient) SendSpikeMetricsArgsForCall(i int) diego_logging_client.SpikeMetric { + fake.sendSpikeMetricsMutex.RLock() + defer fake.sendSpikeMetricsMutex.RUnlock() + argsForCall := fake.sendSpikeMetricsArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeIngressClient) SendSpikeMetricsReturns(result1 error) { + fake.sendSpikeMetricsMutex.Lock() + defer fake.sendSpikeMetricsMutex.Unlock() + fake.SendSpikeMetricsStub = nil + fake.sendSpikeMetricsReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) SendSpikeMetricsReturnsOnCall(i int, result1 error) { + fake.sendSpikeMetricsMutex.Lock() + defer fake.sendSpikeMetricsMutex.Unlock() + fake.SendSpikeMetricsStub = nil + if fake.sendSpikeMetricsReturnsOnCall == nil { + fake.sendSpikeMetricsReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendSpikeMetricsReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressClient) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.incrementCounterMutex.RLock() + defer fake.incrementCounterMutex.RUnlock() + fake.incrementCounterWithDeltaMutex.RLock() + defer fake.incrementCounterWithDeltaMutex.RUnlock() + fake.sendAppErrorLogMutex.RLock() + defer fake.sendAppErrorLogMutex.RUnlock() + fake.sendAppLogMutex.RLock() + defer fake.sendAppLogMutex.RUnlock() + fake.sendAppLogRateMutex.RLock() + defer fake.sendAppLogRateMutex.RUnlock() + fake.sendAppMetricsMutex.RLock() + defer fake.sendAppMetricsMutex.RUnlock() + fake.sendBytesPerSecondMutex.RLock() + defer fake.sendBytesPerSecondMutex.RUnlock() + fake.sendComponentMetricMutex.RLock() + defer fake.sendComponentMetricMutex.RUnlock() + fake.sendDurationMutex.RLock() + defer fake.sendDurationMutex.RUnlock() + fake.sendMebiBytesMutex.RLock() + defer fake.sendMebiBytesMutex.RUnlock() + fake.sendMetricMutex.RLock() + defer fake.sendMetricMutex.RUnlock() + fake.sendRequestsPerSecondMutex.RLock() + defer fake.sendRequestsPerSecondMutex.RUnlock() + fake.sendSpikeMetricsMutex.RLock() + defer fake.sendSpikeMetricsMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeIngressClient) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ diego_logging_client.IngressClient = new(FakeIngressClient) diff --git a/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_sender_server.go b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_sender_server.go new file mode 100644 index 000000000..c47b9e3a0 --- /dev/null +++ b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_sender_server.go @@ -0,0 +1,478 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package testhelpers + +import ( + "sync" + + "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "golang.org/x/net/context" + "google.golang.org/grpc/metadata" +) + +type FakeIngress_SenderServer struct { + SendAndCloseStub func(*loggregator_v2.IngressResponse) error + sendAndCloseMutex sync.RWMutex + sendAndCloseArgsForCall []struct { + arg1 *loggregator_v2.IngressResponse + } + sendAndCloseReturns struct { + result1 error + } + sendAndCloseReturnsOnCall map[int]struct { + result1 error + } + RecvStub func() (*loggregator_v2.Envelope, error) + recvMutex sync.RWMutex + recvArgsForCall []struct{} + recvReturns struct { + result1 *loggregator_v2.Envelope + result2 error + } + recvReturnsOnCall map[int]struct { + result1 *loggregator_v2.Envelope + result2 error + } + SetHeaderStub func(metadata.MD) error + setHeaderMutex sync.RWMutex + setHeaderArgsForCall []struct { + arg1 metadata.MD + } + setHeaderReturns struct { + result1 error + } + setHeaderReturnsOnCall map[int]struct { + result1 error + } + SendHeaderStub func(metadata.MD) error + sendHeaderMutex sync.RWMutex + sendHeaderArgsForCall []struct { + arg1 metadata.MD + } + sendHeaderReturns struct { + result1 error + } + sendHeaderReturnsOnCall map[int]struct { + result1 error + } + SetTrailerStub func(metadata.MD) + setTrailerMutex sync.RWMutex + setTrailerArgsForCall []struct { + arg1 metadata.MD + } + ContextStub func() context.Context + contextMutex sync.RWMutex + contextArgsForCall []struct{} + contextReturns struct { + result1 context.Context + } + contextReturnsOnCall map[int]struct { + result1 context.Context + } + SendMsgStub func(m interface{}) error + sendMsgMutex sync.RWMutex + sendMsgArgsForCall []struct { + m interface{} + } + sendMsgReturns struct { + result1 error + } + sendMsgReturnsOnCall map[int]struct { + result1 error + } + RecvMsgStub func(m interface{}) error + recvMsgMutex sync.RWMutex + recvMsgArgsForCall []struct { + m interface{} + } + recvMsgReturns struct { + result1 error + } + recvMsgReturnsOnCall map[int]struct { + result1 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeIngress_SenderServer) SendAndClose(arg1 *loggregator_v2.IngressResponse) error { + fake.sendAndCloseMutex.Lock() + ret, specificReturn := fake.sendAndCloseReturnsOnCall[len(fake.sendAndCloseArgsForCall)] + fake.sendAndCloseArgsForCall = append(fake.sendAndCloseArgsForCall, struct { + arg1 *loggregator_v2.IngressResponse + }{arg1}) + fake.recordInvocation("SendAndClose", []interface{}{arg1}) + fake.sendAndCloseMutex.Unlock() + if fake.SendAndCloseStub != nil { + return fake.SendAndCloseStub(arg1) + } + if specificReturn { + return ret.result1 + } + return fake.sendAndCloseReturns.result1 +} + +func (fake *FakeIngress_SenderServer) SendAndCloseCallCount() int { + fake.sendAndCloseMutex.RLock() + defer fake.sendAndCloseMutex.RUnlock() + return len(fake.sendAndCloseArgsForCall) +} + +func (fake *FakeIngress_SenderServer) SendAndCloseArgsForCall(i int) *loggregator_v2.IngressResponse { + fake.sendAndCloseMutex.RLock() + defer fake.sendAndCloseMutex.RUnlock() + return fake.sendAndCloseArgsForCall[i].arg1 +} + +func (fake *FakeIngress_SenderServer) SendAndCloseReturns(result1 error) { + fake.SendAndCloseStub = nil + fake.sendAndCloseReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) SendAndCloseReturnsOnCall(i int, result1 error) { + fake.SendAndCloseStub = nil + if fake.sendAndCloseReturnsOnCall == nil { + fake.sendAndCloseReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendAndCloseReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) Recv() (*loggregator_v2.Envelope, error) { + fake.recvMutex.Lock() + ret, specificReturn := fake.recvReturnsOnCall[len(fake.recvArgsForCall)] + fake.recvArgsForCall = append(fake.recvArgsForCall, struct{}{}) + fake.recordInvocation("Recv", []interface{}{}) + fake.recvMutex.Unlock() + if fake.RecvStub != nil { + return fake.RecvStub() + } + if specificReturn { + return ret.result1, ret.result2 + } + return fake.recvReturns.result1, fake.recvReturns.result2 +} + +func (fake *FakeIngress_SenderServer) RecvCallCount() int { + fake.recvMutex.RLock() + defer fake.recvMutex.RUnlock() + return len(fake.recvArgsForCall) +} + +func (fake *FakeIngress_SenderServer) RecvReturns(result1 *loggregator_v2.Envelope, result2 error) { + fake.RecvStub = nil + fake.recvReturns = struct { + result1 *loggregator_v2.Envelope + result2 error + }{result1, result2} +} + +func (fake *FakeIngress_SenderServer) RecvReturnsOnCall(i int, result1 *loggregator_v2.Envelope, result2 error) { + fake.RecvStub = nil + if fake.recvReturnsOnCall == nil { + fake.recvReturnsOnCall = make(map[int]struct { + result1 *loggregator_v2.Envelope + result2 error + }) + } + fake.recvReturnsOnCall[i] = struct { + result1 *loggregator_v2.Envelope + result2 error + }{result1, result2} +} + +func (fake *FakeIngress_SenderServer) SetHeader(arg1 metadata.MD) error { + fake.setHeaderMutex.Lock() + ret, specificReturn := fake.setHeaderReturnsOnCall[len(fake.setHeaderArgsForCall)] + fake.setHeaderArgsForCall = append(fake.setHeaderArgsForCall, struct { + arg1 metadata.MD + }{arg1}) + fake.recordInvocation("SetHeader", []interface{}{arg1}) + fake.setHeaderMutex.Unlock() + if fake.SetHeaderStub != nil { + return fake.SetHeaderStub(arg1) + } + if specificReturn { + return ret.result1 + } + return fake.setHeaderReturns.result1 +} + +func (fake *FakeIngress_SenderServer) SetHeaderCallCount() int { + fake.setHeaderMutex.RLock() + defer fake.setHeaderMutex.RUnlock() + return len(fake.setHeaderArgsForCall) +} + +func (fake *FakeIngress_SenderServer) SetHeaderArgsForCall(i int) metadata.MD { + fake.setHeaderMutex.RLock() + defer fake.setHeaderMutex.RUnlock() + return fake.setHeaderArgsForCall[i].arg1 +} + +func (fake *FakeIngress_SenderServer) SetHeaderReturns(result1 error) { + fake.SetHeaderStub = nil + fake.setHeaderReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) SetHeaderReturnsOnCall(i int, result1 error) { + fake.SetHeaderStub = nil + if fake.setHeaderReturnsOnCall == nil { + fake.setHeaderReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.setHeaderReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) SendHeader(arg1 metadata.MD) error { + fake.sendHeaderMutex.Lock() + ret, specificReturn := fake.sendHeaderReturnsOnCall[len(fake.sendHeaderArgsForCall)] + fake.sendHeaderArgsForCall = append(fake.sendHeaderArgsForCall, struct { + arg1 metadata.MD + }{arg1}) + fake.recordInvocation("SendHeader", []interface{}{arg1}) + fake.sendHeaderMutex.Unlock() + if fake.SendHeaderStub != nil { + return fake.SendHeaderStub(arg1) + } + if specificReturn { + return ret.result1 + } + return fake.sendHeaderReturns.result1 +} + +func (fake *FakeIngress_SenderServer) SendHeaderCallCount() int { + fake.sendHeaderMutex.RLock() + defer fake.sendHeaderMutex.RUnlock() + return len(fake.sendHeaderArgsForCall) +} + +func (fake *FakeIngress_SenderServer) SendHeaderArgsForCall(i int) metadata.MD { + fake.sendHeaderMutex.RLock() + defer fake.sendHeaderMutex.RUnlock() + return fake.sendHeaderArgsForCall[i].arg1 +} + +func (fake *FakeIngress_SenderServer) SendHeaderReturns(result1 error) { + fake.SendHeaderStub = nil + fake.sendHeaderReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) SendHeaderReturnsOnCall(i int, result1 error) { + fake.SendHeaderStub = nil + if fake.sendHeaderReturnsOnCall == nil { + fake.sendHeaderReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendHeaderReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) SetTrailer(arg1 metadata.MD) { + fake.setTrailerMutex.Lock() + fake.setTrailerArgsForCall = append(fake.setTrailerArgsForCall, struct { + arg1 metadata.MD + }{arg1}) + fake.recordInvocation("SetTrailer", []interface{}{arg1}) + fake.setTrailerMutex.Unlock() + if fake.SetTrailerStub != nil { + fake.SetTrailerStub(arg1) + } +} + +func (fake *FakeIngress_SenderServer) SetTrailerCallCount() int { + fake.setTrailerMutex.RLock() + defer fake.setTrailerMutex.RUnlock() + return len(fake.setTrailerArgsForCall) +} + +func (fake *FakeIngress_SenderServer) SetTrailerArgsForCall(i int) metadata.MD { + fake.setTrailerMutex.RLock() + defer fake.setTrailerMutex.RUnlock() + return fake.setTrailerArgsForCall[i].arg1 +} + +func (fake *FakeIngress_SenderServer) Context() context.Context { + fake.contextMutex.Lock() + ret, specificReturn := fake.contextReturnsOnCall[len(fake.contextArgsForCall)] + fake.contextArgsForCall = append(fake.contextArgsForCall, struct{}{}) + fake.recordInvocation("Context", []interface{}{}) + fake.contextMutex.Unlock() + if fake.ContextStub != nil { + return fake.ContextStub() + } + if specificReturn { + return ret.result1 + } + return fake.contextReturns.result1 +} + +func (fake *FakeIngress_SenderServer) ContextCallCount() int { + fake.contextMutex.RLock() + defer fake.contextMutex.RUnlock() + return len(fake.contextArgsForCall) +} + +func (fake *FakeIngress_SenderServer) ContextReturns(result1 context.Context) { + fake.ContextStub = nil + fake.contextReturns = struct { + result1 context.Context + }{result1} +} + +func (fake *FakeIngress_SenderServer) ContextReturnsOnCall(i int, result1 context.Context) { + fake.ContextStub = nil + if fake.contextReturnsOnCall == nil { + fake.contextReturnsOnCall = make(map[int]struct { + result1 context.Context + }) + } + fake.contextReturnsOnCall[i] = struct { + result1 context.Context + }{result1} +} + +func (fake *FakeIngress_SenderServer) SendMsg(m interface{}) error { + fake.sendMsgMutex.Lock() + ret, specificReturn := fake.sendMsgReturnsOnCall[len(fake.sendMsgArgsForCall)] + fake.sendMsgArgsForCall = append(fake.sendMsgArgsForCall, struct { + m interface{} + }{m}) + fake.recordInvocation("SendMsg", []interface{}{m}) + fake.sendMsgMutex.Unlock() + if fake.SendMsgStub != nil { + return fake.SendMsgStub(m) + } + if specificReturn { + return ret.result1 + } + return fake.sendMsgReturns.result1 +} + +func (fake *FakeIngress_SenderServer) SendMsgCallCount() int { + fake.sendMsgMutex.RLock() + defer fake.sendMsgMutex.RUnlock() + return len(fake.sendMsgArgsForCall) +} + +func (fake *FakeIngress_SenderServer) SendMsgArgsForCall(i int) interface{} { + fake.sendMsgMutex.RLock() + defer fake.sendMsgMutex.RUnlock() + return fake.sendMsgArgsForCall[i].m +} + +func (fake *FakeIngress_SenderServer) SendMsgReturns(result1 error) { + fake.SendMsgStub = nil + fake.sendMsgReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) SendMsgReturnsOnCall(i int, result1 error) { + fake.SendMsgStub = nil + if fake.sendMsgReturnsOnCall == nil { + fake.sendMsgReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.sendMsgReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) RecvMsg(m interface{}) error { + fake.recvMsgMutex.Lock() + ret, specificReturn := fake.recvMsgReturnsOnCall[len(fake.recvMsgArgsForCall)] + fake.recvMsgArgsForCall = append(fake.recvMsgArgsForCall, struct { + m interface{} + }{m}) + fake.recordInvocation("RecvMsg", []interface{}{m}) + fake.recvMsgMutex.Unlock() + if fake.RecvMsgStub != nil { + return fake.RecvMsgStub(m) + } + if specificReturn { + return ret.result1 + } + return fake.recvMsgReturns.result1 +} + +func (fake *FakeIngress_SenderServer) RecvMsgCallCount() int { + fake.recvMsgMutex.RLock() + defer fake.recvMsgMutex.RUnlock() + return len(fake.recvMsgArgsForCall) +} + +func (fake *FakeIngress_SenderServer) RecvMsgArgsForCall(i int) interface{} { + fake.recvMsgMutex.RLock() + defer fake.recvMsgMutex.RUnlock() + return fake.recvMsgArgsForCall[i].m +} + +func (fake *FakeIngress_SenderServer) RecvMsgReturns(result1 error) { + fake.RecvMsgStub = nil + fake.recvMsgReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) RecvMsgReturnsOnCall(i int, result1 error) { + fake.RecvMsgStub = nil + if fake.recvMsgReturnsOnCall == nil { + fake.recvMsgReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.recvMsgReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngress_SenderServer) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.sendAndCloseMutex.RLock() + defer fake.sendAndCloseMutex.RUnlock() + fake.recvMutex.RLock() + defer fake.recvMutex.RUnlock() + fake.setHeaderMutex.RLock() + defer fake.setHeaderMutex.RUnlock() + fake.sendHeaderMutex.RLock() + defer fake.sendHeaderMutex.RUnlock() + fake.setTrailerMutex.RLock() + defer fake.setTrailerMutex.RUnlock() + fake.contextMutex.RLock() + defer fake.contextMutex.RUnlock() + fake.sendMsgMutex.RLock() + defer fake.sendMsgMutex.RUnlock() + fake.recvMsgMutex.RLock() + defer fake.recvMsgMutex.RUnlock() + return fake.invocations +} + +func (fake *FakeIngress_SenderServer) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ loggregator_v2.Ingress_SenderServer = new(FakeIngress_SenderServer) diff --git a/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_server.go b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_server.go new file mode 100644 index 000000000..5d4cc7543 --- /dev/null +++ b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/fake_ingress_server.go @@ -0,0 +1,291 @@ +// This Code was generated by counterfeiter, but we had to edit it - see below. +// This is a result of gRPC breaking change referenced here: https://github.com/cloudfoundry/go-loggregator/issues/146 +// The command to generate this file is: `counterfeiter -o testhelpers/ vendor/code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2/ingress_grpc.pb.go IngressServer` +// After generating the file, loggregator_v2.UnimplementedIngressServer will need to be embedded in the FakeIngressServer struct. +// If this file needs to be generated again, the above changes will need to be reapplied. +// In order to pass the linter checks the function `(fake *FakeIngressServer) mustEmbedUnimplementedIngressServer()` should be removed. +package testhelpers + +import ( + "context" + "sync" + + "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" +) + +type FakeIngressServer struct { + loggregator_v2.UnimplementedIngressServer + BatchSenderStub func(loggregator_v2.Ingress_BatchSenderServer) error + batchSenderMutex sync.RWMutex + batchSenderArgsForCall []struct { + arg1 loggregator_v2.Ingress_BatchSenderServer + } + batchSenderReturns struct { + result1 error + } + batchSenderReturnsOnCall map[int]struct { + result1 error + } + SendStub func(context.Context, *loggregator_v2.EnvelopeBatch) (*loggregator_v2.SendResponse, error) + sendMutex sync.RWMutex + sendArgsForCall []struct { + arg1 context.Context + arg2 *loggregator_v2.EnvelopeBatch + } + sendReturns struct { + result1 *loggregator_v2.SendResponse + result2 error + } + sendReturnsOnCall map[int]struct { + result1 *loggregator_v2.SendResponse + result2 error + } + SenderStub func(loggregator_v2.Ingress_SenderServer) error + senderMutex sync.RWMutex + senderArgsForCall []struct { + arg1 loggregator_v2.Ingress_SenderServer + } + senderReturns struct { + result1 error + } + senderReturnsOnCall map[int]struct { + result1 error + } + mustEmbedUnimplementedIngressServerStub func() + mustEmbedUnimplementedIngressServerMutex sync.RWMutex + mustEmbedUnimplementedIngressServerArgsForCall []struct { + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeIngressServer) BatchSender(arg1 loggregator_v2.Ingress_BatchSenderServer) error { + fake.batchSenderMutex.Lock() + ret, specificReturn := fake.batchSenderReturnsOnCall[len(fake.batchSenderArgsForCall)] + fake.batchSenderArgsForCall = append(fake.batchSenderArgsForCall, struct { + arg1 loggregator_v2.Ingress_BatchSenderServer + }{arg1}) + stub := fake.BatchSenderStub + fakeReturns := fake.batchSenderReturns + fake.recordInvocation("BatchSender", []interface{}{arg1}) + fake.batchSenderMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressServer) BatchSenderCallCount() int { + fake.batchSenderMutex.RLock() + defer fake.batchSenderMutex.RUnlock() + return len(fake.batchSenderArgsForCall) +} + +func (fake *FakeIngressServer) BatchSenderCalls(stub func(loggregator_v2.Ingress_BatchSenderServer) error) { + fake.batchSenderMutex.Lock() + defer fake.batchSenderMutex.Unlock() + fake.BatchSenderStub = stub +} + +func (fake *FakeIngressServer) BatchSenderArgsForCall(i int) loggregator_v2.Ingress_BatchSenderServer { + fake.batchSenderMutex.RLock() + defer fake.batchSenderMutex.RUnlock() + argsForCall := fake.batchSenderArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeIngressServer) BatchSenderReturns(result1 error) { + fake.batchSenderMutex.Lock() + defer fake.batchSenderMutex.Unlock() + fake.BatchSenderStub = nil + fake.batchSenderReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressServer) BatchSenderReturnsOnCall(i int, result1 error) { + fake.batchSenderMutex.Lock() + defer fake.batchSenderMutex.Unlock() + fake.BatchSenderStub = nil + if fake.batchSenderReturnsOnCall == nil { + fake.batchSenderReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.batchSenderReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressServer) Send(arg1 context.Context, arg2 *loggregator_v2.EnvelopeBatch) (*loggregator_v2.SendResponse, error) { + fake.sendMutex.Lock() + ret, specificReturn := fake.sendReturnsOnCall[len(fake.sendArgsForCall)] + fake.sendArgsForCall = append(fake.sendArgsForCall, struct { + arg1 context.Context + arg2 *loggregator_v2.EnvelopeBatch + }{arg1, arg2}) + stub := fake.SendStub + fakeReturns := fake.sendReturns + fake.recordInvocation("Send", []interface{}{arg1, arg2}) + fake.sendMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeIngressServer) SendCallCount() int { + fake.sendMutex.RLock() + defer fake.sendMutex.RUnlock() + return len(fake.sendArgsForCall) +} + +func (fake *FakeIngressServer) SendCalls(stub func(context.Context, *loggregator_v2.EnvelopeBatch) (*loggregator_v2.SendResponse, error)) { + fake.sendMutex.Lock() + defer fake.sendMutex.Unlock() + fake.SendStub = stub +} + +func (fake *FakeIngressServer) SendArgsForCall(i int) (context.Context, *loggregator_v2.EnvelopeBatch) { + fake.sendMutex.RLock() + defer fake.sendMutex.RUnlock() + argsForCall := fake.sendArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeIngressServer) SendReturns(result1 *loggregator_v2.SendResponse, result2 error) { + fake.sendMutex.Lock() + defer fake.sendMutex.Unlock() + fake.SendStub = nil + fake.sendReturns = struct { + result1 *loggregator_v2.SendResponse + result2 error + }{result1, result2} +} + +func (fake *FakeIngressServer) SendReturnsOnCall(i int, result1 *loggregator_v2.SendResponse, result2 error) { + fake.sendMutex.Lock() + defer fake.sendMutex.Unlock() + fake.SendStub = nil + if fake.sendReturnsOnCall == nil { + fake.sendReturnsOnCall = make(map[int]struct { + result1 *loggregator_v2.SendResponse + result2 error + }) + } + fake.sendReturnsOnCall[i] = struct { + result1 *loggregator_v2.SendResponse + result2 error + }{result1, result2} +} + +func (fake *FakeIngressServer) Sender(arg1 loggregator_v2.Ingress_SenderServer) error { + fake.senderMutex.Lock() + ret, specificReturn := fake.senderReturnsOnCall[len(fake.senderArgsForCall)] + fake.senderArgsForCall = append(fake.senderArgsForCall, struct { + arg1 loggregator_v2.Ingress_SenderServer + }{arg1}) + stub := fake.SenderStub + fakeReturns := fake.senderReturns + fake.recordInvocation("Sender", []interface{}{arg1}) + fake.senderMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeIngressServer) SenderCallCount() int { + fake.senderMutex.RLock() + defer fake.senderMutex.RUnlock() + return len(fake.senderArgsForCall) +} + +func (fake *FakeIngressServer) SenderCalls(stub func(loggregator_v2.Ingress_SenderServer) error) { + fake.senderMutex.Lock() + defer fake.senderMutex.Unlock() + fake.SenderStub = stub +} + +func (fake *FakeIngressServer) SenderArgsForCall(i int) loggregator_v2.Ingress_SenderServer { + fake.senderMutex.RLock() + defer fake.senderMutex.RUnlock() + argsForCall := fake.senderArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeIngressServer) SenderReturns(result1 error) { + fake.senderMutex.Lock() + defer fake.senderMutex.Unlock() + fake.SenderStub = nil + fake.senderReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressServer) SenderReturnsOnCall(i int, result1 error) { + fake.senderMutex.Lock() + defer fake.senderMutex.Unlock() + fake.SenderStub = nil + if fake.senderReturnsOnCall == nil { + fake.senderReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.senderReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeIngressServer) MustEmbedUnimplementedIngressServerCallCount() int { + fake.mustEmbedUnimplementedIngressServerMutex.RLock() + defer fake.mustEmbedUnimplementedIngressServerMutex.RUnlock() + return len(fake.mustEmbedUnimplementedIngressServerArgsForCall) +} + +func (fake *FakeIngressServer) MustEmbedUnimplementedIngressServerCalls(stub func()) { + fake.mustEmbedUnimplementedIngressServerMutex.Lock() + defer fake.mustEmbedUnimplementedIngressServerMutex.Unlock() + fake.mustEmbedUnimplementedIngressServerStub = stub +} + +func (fake *FakeIngressServer) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.batchSenderMutex.RLock() + defer fake.batchSenderMutex.RUnlock() + fake.sendMutex.RLock() + defer fake.sendMutex.RUnlock() + fake.senderMutex.RLock() + defer fake.senderMutex.RUnlock() + fake.mustEmbedUnimplementedIngressServerMutex.RLock() + defer fake.mustEmbedUnimplementedIngressServerMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeIngressServer) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ loggregator_v2.IngressServer = new(FakeIngressServer) diff --git a/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/ingress_server.go b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/ingress_server.go new file mode 100644 index 000000000..eaa599ab5 --- /dev/null +++ b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/ingress_server.go @@ -0,0 +1,93 @@ +package testhelpers + +import ( + "crypto/tls" + "crypto/x509" + "net" + "os" + "strconv" + + "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + +type TestIngressServer struct { + receivers chan loggregator_v2.Ingress_BatchSenderServer + addr string + tlsConfig *tls.Config + grpcServer *grpc.Server +} + +func NewTestIngressServer(serverCert, serverKey, caCert string) (*TestIngressServer, error) { + cert, err := tls.LoadX509KeyPair(serverCert, serverKey) + if err != nil { + return nil, err + } + + tlsConfig := &tls.Config{ + Certificates: []tls.Certificate{cert}, + ClientAuth: tls.RequestClientCert, + InsecureSkipVerify: false, + } + caCertBytes, err := os.ReadFile(caCert) + if err != nil { + return nil, err + } + + caCertPool := x509.NewCertPool() + caCertPool.AppendCertsFromPEM(caCertBytes) + tlsConfig.RootCAs = caCertPool + + return &TestIngressServer{ + tlsConfig: tlsConfig, + receivers: make(chan loggregator_v2.Ingress_BatchSenderServer), + addr: "localhost:0", + }, nil +} + +func (t *TestIngressServer) Port() (int, error) { + _, port, err := net.SplitHostPort(t.Addr()) + if err != nil { + return 0, err + } + return strconv.Atoi(port) +} + +func (t *TestIngressServer) Addr() string { + return t.addr +} + +func (t *TestIngressServer) Receivers() chan loggregator_v2.Ingress_BatchSenderServer { + return t.receivers +} + +func (t *TestIngressServer) Start() error { + listener, err := net.Listen("tcp4", t.addr) + if err != nil { + return err + } + t.addr = listener.Addr().String() + + var opts []grpc.ServerOption + if t.tlsConfig != nil { + opts = append(opts, grpc.Creds(credentials.NewTLS(t.tlsConfig))) + } + t.grpcServer = grpc.NewServer(opts...) + + senderServer := &FakeIngressServer{} + senderServer.BatchSenderStub = func(recv loggregator_v2.Ingress_BatchSenderServer) error { + t.receivers <- recv + <-recv.Context().Done() + return nil + } + loggregator_v2.RegisterIngressServer(t.grpcServer, senderServer) + + go t.grpcServer.Serve(listener) + + return nil +} + +func (t *TestIngressServer) Stop() { + t.grpcServer.Stop() +} diff --git a/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/matchers.go b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/matchers.go new file mode 100644 index 000000000..16dce3a12 --- /dev/null +++ b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/matchers.go @@ -0,0 +1,67 @@ +package testhelpers + +import ( + "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "github.com/onsi/gomega" + "github.com/onsi/gomega/types" +) + +type MetricAndValue struct { + Name string + Value int32 +} + +func MatchV2Metric(target MetricAndValue) types.GomegaMatcher { + return gomega.SatisfyAll( + gomega.WithTransform(func(source *loggregator_v2.Envelope) *loggregator_v2.Gauge { + return source.GetGauge() + }, gomega.Not(gomega.BeNil())), + gomega.WithTransform(func(source *loggregator_v2.Envelope) map[string]*loggregator_v2.GaugeValue { + return source.GetGauge().GetMetrics() + }, gomega.HaveKey(target.Name)), + ) +} + +func MatchV2MetricAndValue(target MetricAndValue) types.GomegaMatcher { + return gomega.SatisfyAll( + gomega.WithTransform(func(source *loggregator_v2.Envelope) *loggregator_v2.Gauge { + return source.GetGauge() + }, gomega.Not(gomega.BeNil())), + gomega.WithTransform(func(source *loggregator_v2.Envelope) map[string]*loggregator_v2.GaugeValue { + return source.GetGauge().GetMetrics() + }, gomega.HaveKey(target.Name)), + gomega.WithTransform(func(source *loggregator_v2.Envelope) int32 { + return int32(source.GetGauge().GetMetrics()[target.Name].Value) + }, gomega.Equal(target.Value)), + ) +} + +func TestMetricChan(receiversChan chan loggregator_v2.Ingress_BatchSenderServer) (chan *loggregator_v2.Envelope, chan struct{}) { + signalMetricsChan := make(chan struct{}) + testMetricsChan := make(chan *loggregator_v2.Envelope) + go func() { + for { + select { + case receiver := <-receiversChan: + go func() { + for { + batch, err := receiver.Recv() + if err != nil { + return + } + for _, envelope := range batch.Batch { + select { + case testMetricsChan <- envelope: + case <-signalMetricsChan: + return + } + } + } + }() + case <-signalMetricsChan: + return + } + } + }() + return testMetricsChan, signalMetricsChan +} diff --git a/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/package.go b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/package.go new file mode 100644 index 000000000..199149c1b --- /dev/null +++ b/src/code.cloudfoundry.org/vendor/code.cloudfoundry.org/diego-logging-client/testhelpers/package.go @@ -0,0 +1 @@ +package testhelpers // import "code.cloudfoundry.org/diego-logging-client/testhelpers" diff --git a/src/code.cloudfoundry.org/vendor/modules.txt b/src/code.cloudfoundry.org/vendor/modules.txt index 38b716825..7565a9f91 100644 --- a/src/code.cloudfoundry.org/vendor/modules.txt +++ b/src/code.cloudfoundry.org/vendor/modules.txt @@ -32,6 +32,7 @@ code.cloudfoundry.org/debugserver # code.cloudfoundry.org/diego-logging-client v0.77.0 ## explicit; go 1.24.0 code.cloudfoundry.org/diego-logging-client +code.cloudfoundry.org/diego-logging-client/testhelpers # code.cloudfoundry.org/durationjson v0.56.0 ## explicit; go 1.24.0 code.cloudfoundry.org/durationjson