Skip to content

Commit

Permalink
changed test server and added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sjordhani22 committed Nov 30, 2021
1 parent 0d8c647 commit 7b04260
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions js/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2103,26 +2103,34 @@ func TestForceHTTP1Feature(t *testing.T) {
}()
assert.Equal(t, tc.expectedForceH1Result, forceHTTP1())

r1, err := getSimpleRunner(t, "/script.js", fmt.Sprintf(`var k6 = require("k6");
tb := httpmultibin.NewHTTPMultiBin(t)

data := fmt.Sprintf(`var k6 = require("k6");
var check = k6.check;
var fail = k6.fail;
var http = require("k6/http");;
exports.default = function() {
var res = http.get("https://k6.io/");
var res = http.get("HTTP2BIN_URL");
if (
!check(res, {
'checking to see if status was 200': (res) => res.status === 200,
'checking to see if protocol was H2': (res) => res.proto === '%s'
'checking to see protocol': (res) => res.proto === '%s'
})
) {
fail('test failed')
}
}`, tc.protocol))
}`, tc.protocol)

r1, err := getSimpleRunner(t, "/script.js", tb.Replacer.Replace(data))
require.NoError(t, err)

err = r1.SetOptions(lib.Options{
Hosts: tb.Dialer.Hosts,
// We disable TLS verify so that we don't get a TLS handshake error since
// the certificates on the endpoint are not certified by a certificate authority
InsecureSkipTLSVerify: null.BoolFrom(true),
})

require.NoError(t, err)

registry := metrics.NewRegistry()
Expand Down

0 comments on commit 7b04260

Please sign in to comment.