Skip to content

Commit

Permalink
Merge branch 'devel' into ekans-arbok
Browse files Browse the repository at this point in the history
  • Loading branch information
resoluteCoder authored Jul 31, 2024
2 parents 642d56a + 1cffdce commit 4930d3f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/source/user_guide/configuration_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ Work Kubernetes
work-kubernetes:
- worktype: cat
^^^^^^^^^^^^
Work Signing
^^^^^^^^^^^^
Expand Down
22 changes: 21 additions & 1 deletion pkg/controlsvc/controlsvc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func TestRunControlSvc(t *testing.T) {
mockNetceptor := mock_controlsvc.NewMockNetceptorForControlsvc(ctrl)
mockUnix := mock_controlsvc.NewMockUtiler(ctrl)
mockNet := mock_controlsvc.NewMockNeter(ctrl)
mockTLS := mock_controlsvc.NewMockTlser(ctrl)
mockListener := mock_controlsvc.NewMockListener(ctrl)

logger := logger.NewReceptorLogger("")

runControlSvcTestCases := []struct {
name string
Expand Down Expand Up @@ -158,6 +162,21 @@ func TestRunControlSvc(t *testing.T) {
"tcpListen": "",
},
},
{
name: "tcp listener set",
expectedError: "",
expectedCalls: func() {
mockNet.EXPECT().Listen(gomock.Any(), gomock.Any()).Return(mockListener, nil)
mockTLS.EXPECT().NewListener(gomock.Any(), gomock.Any()).Return(mockListener)
mockNetceptor.EXPECT().GetLogger().Return(logger).AnyTimes()
mockListener.EXPECT().Accept().Return(nil, errors.New("normal close")).AnyTimes()
},
listeners: map[string]string{
"service": "",
"unixSocket": "",
"tcpListen": "tcp:1",
},
},
}

for _, testCase := range runControlSvcTestCases {
Expand All @@ -166,10 +185,11 @@ func TestRunControlSvc(t *testing.T) {
s := controlsvc.New(false, mockNetceptor)
s.SetServerUtils(mockUnix)
s.SetServerNet(mockNet)
s.SetServerTLS(mockTLS)

err := s.RunControlSvc(context.Background(), testCase.listeners["service"], &tls.Config{}, testCase.listeners["unixSocket"], os.FileMode(0o600), testCase.listeners["tcpListen"], &tls.Config{})

if err.Error() != testCase.expectedError {
if err != nil && err.Error() != testCase.expectedError {
t.Errorf("expected error %s, got %v", testCase.expectedError, err)
}
})
Expand Down
1 change: 1 addition & 0 deletions pkg/workceptor/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ func (kw *KubeUnit) runWorkUsingLogger() {
// this is probably not possible...
errMsg := fmt.Sprintf("Error reading stdin: %s", stdin.Error())
kw.GetWorkceptor().nc.GetLogger().Error(errMsg)
kw.GetWorkceptor().nc.GetLogger().Error("Pod status at time of error %s", kw.pod.Status.String())
kw.UpdateBasicStatus(WorkStateFailed, errMsg, stdout.Size())

close(stdinErrChan) // signal STDOUT goroutine to stop
Expand Down
9 changes: 7 additions & 2 deletions pkg/workceptor/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package workceptor

import (
"encoding/json"
"errors"
"fmt"
"os/exec"

Expand All @@ -22,6 +23,7 @@ type pythonUnit struct {

// Start launches a job with given parameters.
func (pw *pythonUnit) Start() error {
pw.UpdateBasicStatus(WorkStatePending, "[DEPRECATION WARNING] This option is not currently being used. This feature will be removed from receptor in a future release.", 0)
pw.UpdateBasicStatus(WorkStatePending, "Launching Python runner", 0)
config := make(map[string]interface{})
for k, v := range pw.config {
Expand Down Expand Up @@ -73,7 +75,9 @@ func (cfg WorkPythonCfg) NewWorker(_ BaseWorkUnitForWorkUnit, w *Workceptor, uni
func (cfg WorkPythonCfg) Run() error {
err := MainInstance.RegisterWorker(cfg.WorkType, cfg.NewWorker, false)

return err
errWithDeprecation := errors.Join(err, errors.New("[DEPRECATION WARNING] This option is not currently being used. This feature will be removed from receptor in a future release"))

return errWithDeprecation
}

func init() {
Expand All @@ -82,5 +86,6 @@ func init() {
return
}
cmdline.RegisterConfigTypeForApp("receptor-workers",
"work-python", "Run a worker using a Python plugin", WorkPythonCfg{}, cmdline.Section(workersSection))
"work-python", "Run a worker using a Python plugin\n[DEPRECATION WARNING] This option is not currently being used. This feature will be removed from receptor in a future release.", workPythonCfg{}, cmdline.Section(workersSection))

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / go test coverage

undefined: workPythonCfg

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: workPythonCfg

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: workPythonCfg

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: workPythonCfg

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: workPythonCfg

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / lint-receptor

undefined: workPythonCfg

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / receptor (Go 1.20)

undefined: workPythonCfg

Check failure on line 89 in pkg/workceptor/python.go

View workflow job for this annotation

GitHub Actions / receptor (Go 1.21)

undefined: workPythonCfg

}

0 comments on commit 4930d3f

Please sign in to comment.