test: simplify regression test for SEGV · nodejs/node@624a242 (original) (raw)

Original file line number Diff line number Diff line change
@@ -38,19 +38,19 @@ const tls = require('tls');
38 38 const fixtures = require('../common/fixtures');
39 39
40 40 // Test Certificates
41 -const caPem = fixtures.readSync('test_ca.pem', 'ascii');
42 -const certPem = fixtures.readSync('test_cert.pem', 'ascii');
43 41 const certPfx = fixtures.readSync('test_cert.pfx');
44 -const keyPem = fixtures.readSync('test_key.pem', 'ascii');
45 42
46 43 // 'this' safety
47 44 // https://github.com/joyent/node/issues/6690
48 45 assert.throws(function() {
49 -const options = { key: keyPem, cert: certPem, ca: caPem };
50 -const credentials = tls.createSecureContext(options);
46 +const credentials = tls.createSecureContext();
51 47 const context = credentials.context;
52 -const notcontext = { setOptions: context.setOptions, setKey: context.setKey };
53 -tls.createSecureContext({ secureOptions: 1 }, notcontext);
48 +const notcontext = { setOptions: context.setOptions };
49 +
50 +// Methods of native objects should not segfault when reassigned to a new
51 +// object and called illegally. This core dumped in 0.10 and was fixed in
52 +// 0.11.
53 +notcontext.setOptions();
54 54 }, (err) => {
55 55 // Throws TypeError, so there is no opensslErrorStack property.
56 56 if ((err instanceof Error) &&