Hi, with the test.js file i setup a kubernetes configmap and the corresponding k6 CRD. the only thing i get when running the file is the console.log outputs before the export default fucntion but the export default function never seems to execute it always stuck on running with pod status.
import http from 'k6/http';
import { check } from 'k6';
console.log("test");
export let options = {
stages: [
{ target: 1, duration: '3s' },
{ target: 1, duration: '3s' },
],
};
console.log("test2");
export default function () {
console.log("made it");
const result = http.get('https://test-api.k6.io/public/crocodiles/');
check(result, {
'http response status code is 200': result.status === 200,
});
}
failed to get status from <service> {"namespace": "k6-operator-system", "name": "<service>", "reconcileID": "######", "error": "Get \"http://<service>.k6-operator-system.svc.cluster.local:6565/v1/status\": dial tcp: lookup <service>.k6-operator-system.svc.cluster.local on <ip>: no such host"}
i figured out the error, we are running it on a different kubernetes domain name but i cant seem to compile the code again and fix it?
I changed the code from here
func isServiceReady(log logr.Logger, service *v1.Service) bool {
resp, err := http.Get(fmt.Sprintf("http://%v.%v.svc.<custom domain>:6565/v1/status", service.ObjectMeta.Name, service.ObjectMeta.Namespace))
if err != nil {
log.Error(err, fmt.Sprintf("failed to get status from %v", service.ObjectMeta.Name))
return false
}
return resp.StatusCode < 400
}
but still giving me the same error. i geuss it has to do with compiling the new code but i cant seem to figure out how to do that as its not displaying my printf(‘testlogtest’) eather in the code.