Commit 8b688a78 authored by vicotor's avatar vicotor

fix bug

parent d8c275e9
...@@ -76,6 +76,7 @@ type defineStdTask struct { ...@@ -76,6 +76,7 @@ type defineStdTask struct {
TaskFee string `json:"task_fee,omitempty"` TaskFee string `json:"task_fee,omitempty"`
TaskWorkload int64 `json:"task_workload,omitempty"` TaskWorkload int64 `json:"task_workload,omitempty"`
ContainerPubkey string ` json:"container_pubkey,omitempty"` ContainerPubkey string ` json:"container_pubkey,omitempty"`
Standlib string `json:"standlib,omitempty"`
} }
func loadStdTasks() []StdTask { func loadStdTasks() []StdTask {
...@@ -101,7 +102,7 @@ func loadStdTasks() []StdTask { ...@@ -101,7 +102,7 @@ func loadStdTasks() []StdTask {
stdTasks[i].TaskFee = defStdTask.TaskFee stdTasks[i].TaskFee = defStdTask.TaskFee
stdTasks[i].TaskWorkload = defStdTask.TaskWorkload stdTasks[i].TaskWorkload = defStdTask.TaskWorkload
stdTasks[i].ContainerPubkey = common.Hex2Bytes(defStdTask.ContainerPubkey) stdTasks[i].ContainerPubkey = common.Hex2Bytes(defStdTask.ContainerPubkey)
stdTasks[i].Standlib = defStdTask.TaskCmd stdTasks[i].Standlib = defStdTask.Standlib
} }
return stdTasks return stdTasks
......
...@@ -3,6 +3,7 @@ package standardlib ...@@ -3,6 +3,7 @@ package standardlib
import ( import (
"github.com/magiconair/properties/assert" "github.com/magiconair/properties/assert"
"github.com/odysseus/nodemanager/config" "github.com/odysseus/nodemanager/config"
log "github.com/sirupsen/logrus"
"testing" "testing"
) )
...@@ -10,8 +11,14 @@ func TestNewStandardTasks(t *testing.T) { ...@@ -10,8 +11,14 @@ func TestNewStandardTasks(t *testing.T) {
config.ParseConfig("../config.toml") config.ParseConfig("../config.toml")
s := NewStandardTasks() s := NewStandardTasks()
{ {
_, exist := s.GetTask(999) ts, exist := s.GetTask(998)
assert.Equal(t, exist, true) assert.Equal(t, exist, true)
log.Print(ts.Standlib)
lib := s.GetStdLib(ts.TaskType)
if lib == nil {
t.Fail()
}
} }
{ {
_, exist := s.GetTask(10) _, exist := s.GetTask(10)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment