-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
record-tester: added access control testing #220
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -156,6 +184,19 @@ func (rt *recordTester) Start(fileName string, testDuration, pauseDuration time. | |||
mediaURL := fmt.Sprintf("%s/%s/index.m3u8", ingest.Playback, stream.PlaybackID) | |||
glog.V(model.SHORT).Infof("RTMP: %s", rtmpURL) | |||
glog.V(model.SHORT).Infof("MEDIA: %s", mediaURL) | |||
|
|||
if rt.accessControl && (rt.signingKey != "" && rt.publicKey != "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having accessControl
and not the signing key should be an explicit fatal error. We should not ignore the setting because another required option was not provided, it is better to just fail the whole test.
if rt.accessControl && (rt.signingKey != "" && rt.publicKey != "") { | |
if rt.accessControl { | |
if rt.signingKey == "" || rt.publicKey == "" { | |
msg := "Signing key and public key are required for access control test" | |
glog.Fatal(msg) | |
return 1, errors.New(msg) // (Fatal log above already exits the process but you know just in case, leave it clear here that we end with an error) | |
} |
} else { | ||
glog.Warningf("No access control for stream id=%s playbackId=%s name=%s mediaURL=%s", stream.ID, stream.PlaybackID, streamName, mediaURL) | ||
return 2, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to log this as a warning or returning. Executing a test without access control is perfectly acceptable. And we already log above when we use access control so no need to log when we don't.
} else { | |
glog.Warningf("No access control for stream id=%s playbackId=%s name=%s mediaURL=%s", stream.ID, stream.PlaybackID, streamName, mediaURL) | |
return 2, nil | |
} | |
} |
// uploader := testers.NewRtmpStreamer(gctx, rtmpURL) | ||
// uploader.StartUpload(fileName, rtmpURL, -1, 30*time.Second) | ||
return es, err | ||
return 0, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We know err
is nil
here so we can be explicit. Just so one doesn't start wondering here where this err
could be instead of nil
(from what I checked, it can't)
return 0, err | |
return 0, nil |
if err != nil { | ||
glog.Errorf("Unable to parse provided signing key for access control signingKey=%s", rt.signingKey) | ||
} | ||
|
||
token, err := unsignedToken.SignedString(pk) | ||
|
||
if err != nil { | ||
glog.Errorf("Unable to sign JWT with provided private key for access control signingKey=%s", rt.signingKey) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to return all these errors. Cannot just log.
if err != nil { | |
glog.Errorf("Unable to parse provided signing key for access control signingKey=%s", rt.signingKey) | |
} | |
token, err := unsignedToken.SignedString(pk) | |
if err != nil { | |
glog.Errorf("Unable to sign JWT with provided private key for access control signingKey=%s", rt.signingKey) | |
} | |
if err != nil { | |
glog.Errorf("Unable to parse provided signing key for access control signingKey=%s", rt.signingKey) | |
return "", err | |
} | |
token, err := unsignedToken.SignedString(pk) | |
if err != nil { | |
glog.Errorf("Unable to sign JWT with provided private key for access control signingKey=%s", rt.signingKey) | |
return "", err | |
} |
Fixes #204