Skip to content

Commit

Permalink
chore: fix tls tests in net instrumentation (open-telemetry#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud authored May 25, 2021
1 parent af77aad commit 861fcfc
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 88 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDbTCCAlWgAwIBAgIUPrEH0CT542Rrkjbj48sUe9Y1GtkwDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAgFw0yMTA1MjUwNzQ4NDdaGA8yMTIx
MDUwMTA3NDg0N1owRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcN
AQEBBQADggEPADCCAQoCggEBAKkheuhMTzbRXP4tWMb8zZTfCdu3Dp4/bKfIl4aM
FGWObV7bi8eXoxhXnHhmrwyyxzFyejNFEcVMrjAUUWL8hjth+gEgsRB3SQG7OIlh
8m+oWMnZ39dxllOccSMoOtQuTYJ4pqxEXzIiHG4jJasVpUajmXZ5a+paqUAIy7DP
nbVeW5T+gCj43MMTGiH5b7i8KxSgPKriMPG3YJA4K5+SFsQxIvhVTsuQt//cXhfB
44yLeGEsEIVlImXahRzr7XoRYRbGQeJoqPAy+o88cdeeidqokX32Ej5AKILOBoBE
DBVRCYagUs5vhzPoQUst0Kxt61d8+gRQ1co1dRmop1SKHRUCAwEAAaNTMFEwHQYD
VR0OBBYEFGX8Xlq7EQiIjLUwX07hJHj0cePGMB8GA1UdIwQYMBaAFGX8Xlq7EQiI
jLUwX07hJHj0cePGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB
ADSqVpuXJyClppGxXsw2C5EV2a4ocWOGvi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7OS+ZEBNCLCxSvm3yy3yezfl4bN5ohF4nCL
4RHNV7fm6cACLykrU/Ey3elGzHV4bh2JN+XxZdE3wQKBgQDRfx0Lz9b7fJHi18SU
z9YV4lBQlA3PRuRM+S69xbIpVGW3CIP7fj5g/dhU8Fh4QJoSiLqFTgBrbbQ63O9a
iKIBkExfHY7EnYnl54qlo0ZZl0kBy6s8gWnpKlKAEUHx6P+gvSTly/uSl95mzxQr
+aH0JHmRU4J9FHsvOcvfVILMsQKBgQDOrIkFMjlD6Wdh5EtV86f8XbB4X5av+wHX
snxvzmJ8U2NPmEPs2tTpyW91OqxFLYdx+p+fBdDeCQBFEgfCq/S85Cq6JNm/pb7/
OigOWo9Wr02blx9SH8rKBxDhYzu7v39IuDuv0B7IgS+YUH3VlDs3yWhmmc431B+h
XaRB7k7fpQKBgQCqQuPJaMZxJ4GtWe0DgJKewIrDokBC+Hutb0skopq0akosYnhZ
mfV6gHQkPB26xc4yR/tHQeinZsZ2nH7PFoKMQMlA+FXCx8J+HhsZmUQgpgqIsg1e
JFN+U44vVVdCEzpGWdK2DH1OW6094wii4MRWFprSmItRuqaO8CsYO6f+UQKBgQCj
9L4ysBg75vML9sdJJaXzkAPKStLJQxDAJCmRrSH2TVTwtPPV9/iGizXvwx8dNjRI
WLG+vydmra9YHCip6C6cl0nKKCfSYNP3uBRE5tTlyOaBc072oKAIy7g5hbbCh/Wb
JAS9whZZrBqs89YP1Ktx40b+di/hnFeHdTk00LAjvQKBgHm3fZsV/z/BsCm6zD5W
yZji3v6qpB4PsFbdk9xJuLkRJEFmkCeGjQyc9Z2UCXE69b7WzbmLPg1gX5fTixsA
T5R2mjCMMj37Fot2IxEjhf0TQpnPNCB7bde3pPYoYJnV29tLVebm5L87wu82I7tm
CI+WmYN5Q3rqYZVIF1k2maD+
-----END PRIVATE KEY-----
99 changes: 11 additions & 88 deletions plugins/node/opentelemetry-instrumentation-net/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import * as os from 'os';
import { Socket } from 'net';
import { IPC_TRANSPORT } from '../src/utils';
import { TLSAttributes } from '../src/types';
import * as fs from 'fs';

export const PORT = 42123;
export const HOST = 'localhost';
Expand Down Expand Up @@ -80,22 +81,22 @@ export function assertTLSSpan(
assertAttrib(
tlsSpan,
TLSAttributes.CERTIFICATE_FINGERPRINT,
'60:58:0C:4B:52:20:2A:53:4F:50:93:3A:2F:F7:72:06:DD:B3:30:DC'
'95:DD:2A:8D:CE:D2:E7:74:7C:73:C0:83:2B:46:F8:88:E8:89:60:C5'
);
assertAttrib(
tlsSpan,
TLSAttributes.CERTIFICATE_SERIAL_NUMBER,
'D789EA9C1A7887D5'
'3EB107D024F9E3646B9236E3E3CB147BD6351AD9'
);
assertAttrib(
tlsSpan,
TLSAttributes.CERTIFICATE_VALID_FROM,
'Apr 22 12:27:31 2021 GMT'
'May 25 07:48:47 2021 GMT'
);
assertAttrib(
tlsSpan,
TLSAttributes.CERTIFICATE_VALID_TO,
'May 22 12:27:31 2021 GMT'
'May 1 07:48:47 2121 GMT'
);
}

Expand All @@ -107,88 +108,10 @@ export function assertAttrib(span: ReadableSpan, attrib: string, value: any) {
assert.strictEqual(span.attributes[attrib], value);
}

export const TLS_SERVER_CERT = `-----BEGIN CERTIFICATE-----
MIIFrjCCA5YCCQDXieqcGniH1TANBgkqhkiG9w0BAQUFADCBmDELMAkGA1UEBhMC
RVgxEDAOBgNVBAgMB0V4YW1wbGUxFTATBgNVBAcMDEV4YW1wbGUgQ2l0eTEWMBQG
A1UECgwNT3BlblRlbGVtZXRyeTETMBEGA1UECwwKSlMgQ29udHJpYjESMBAGA1UE
AwwJbG9jYWxob3N0MR8wHQYJKoZIhvcNAQkBFhB0ZXN0QGV4YW1wbGUuY29tMB4X
DTIxMDQyMjEyMjczMVoXDTIxMDUyMjEyMjczMVowgZgxCzAJBgNVBAYTAkVYMRAw
DgYDVQQIDAdFeGFtcGxlMRUwEwYDVQQHDAxFeGFtcGxlIENpdHkxFjAU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aFHCSLn2Ee7ArHF4T9nuSEnxFTao99zo8zQdwz
Suye5FLiHtgAK7J17uACB++VzyRPR/9MjOf1JOtZoM5sMW7ivWahvU8YTDyOsYSp
E0K5NlIpZaZI8kfXkDV09UIzaxw2RwObDf6CNzRYWhG1kS/nTyA+5Ni6OjTck/6P
/7OB5TNXiGdWs6mf1NcdwGUPKYQH4w/NYBs5auLpuluGgtcA9tCHKBnQ7IHdhYmh
OYoaBdyH3PhVxxFM+lny+p4ILsr9wNkEBkU0ox+xGbp8MgrO5pKL0pFy0KqQwQxb
V/Y4o5xOXS4WgBeaxkZyDYRUsqytiur45+se4iKmH8q08H0kFEmZlhKVKecquZx9
MqTXbVIYqzUyx1hD8SnvtiDvDl3K7pb5EN41pfDrvcxlQ526Yrdtkurh4VmlRLr0
IuxGGP0Nxr1/Sb+WKA7Oi+iBQnoCKyC9InvlNGETmnqdyTeOuvYz/LzCbpB/cKUR
fkjAnQ+Dk8cIznfmjHp6IJw1
-----END CERTIFICATE-----`;
export const TLS_SERVER_CERT = fs
.readFileSync(path.resolve(__dirname, './fixtures/tls.crt'))
.toString();

export const TLS_SERVER_KEY = `-----BEGIN RSA PRIVATE KEY-----
MIIJKQIBAAKCAgEA7grPn4oLApCDt6iOjLN5PN0jnZpY3lsTJIcHfr6Fdq1UQF/V
r/TUIgrGZk9qVEmPo+iMPIs0bN/q55VAgnYHwDsbgjt4OoqO6qFhtomlSbYiX1Ej
pAfkiE0xpVps46mlhfkU0c6HrHsxRVDQmy0f+U2vw3PIOmR9kkZtbM8WZg6y2JTP
dmT4btckBP4cMFY5aJN1yyWxeyXSCJjNtnRXf6h8DRX9KndQNsVLEBZ1DR/GJrV8
Ia5tiF5k/rDysAjPyuhzyQO+W+BajC6qW0ZIsugJ56L/fF5kHwsWXfu8TfyeI4zE
hydRLl12caA7iO+U5vqIZ7fVE0FtVTg2FEo4Q4rDL4ZB/G5lEfid/N073zg4+mP8
scFuAMIyR6forGY8/OdnwrWOZPw+VILTgpznP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4oHVTGi64rDB1yKFRCFMxgvbH8jA6oJv4ZEWzhH
yMo5gsAdAXkSRN0idjU7vTX20OBSKDTeT9W1TRxkKGA0Q5WL5ZAFem/nuNX2uQ8Z
68hQSOTaIwzugk72Y/ARWcuL4Zi7tYjPN0sltcMJj52RPyDFB9mGuQRnysNvmfiv
gzTwdfuuuK52v/LeuGhAyb+onmvcv1V/DZl5i8C4jis5dVUCzdcUhFP/HHY0cWNk
VI6D5PzmlZUMac7dGWO5c4Dc6Mk8FFPdAoIBAQC8EZHv9kdPaYKfdY0i4k/A2Qxo
oGXSHFGDgSQ2FfRfX5LjPZprj5NuMeyOydhCQYmIYGYi1nPdocmXpji9WIAEWs7B
4h6rAx5oXMlEunQLoJcaHvB9/k/OVR7lY25shARn68aSuXxWaGWbEsZwywaFRycn
mHYPRGZcEmVR0AKe5c3EbKdEU2MxuwM4oA+jk6k9agKObpMbwpQAxDggxieWkVIR
seLh8p0sBgCFJFBSSIH0nXcWTdksM3iou+tFz1f6LKB+kXflOr2lF9x5h2Bov9iD
KTAvTzhtca+PjuoZzUGXICReDu4Fy2HL4bzzb25dy9jeHn5l6XbKWZ1R7NRd
-----END RSA PRIVATE KEY-----`;
export const TLS_SERVER_KEY = fs
.readFileSync(path.resolve(__dirname, './fixtures/tls.key'))
.toString();

0 comments on commit 861fcfc

Please sign in to comment.