58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
package service
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/smartystreets/goconvey/convey"
|
|
"gitlink.org.cn/JointCloud/pcm-participant-modelarts/model"
|
|
|
|
"testing"
|
|
)
|
|
|
|
func TestAlgorithm(t *testing.T) {
|
|
url := "https://modelarts.cn-south-222.ai.pcl.cn"
|
|
projectId := "d18190e28e3f45a281ef0b0696ec9d52"
|
|
convey.Convey("AlgorithmList", t, func() {
|
|
param := &model.AlgorithmListParam{
|
|
Offset: 5,
|
|
}
|
|
list, err := AlgorithmList(url, projectId, param)
|
|
if err != nil {
|
|
fmt.Println(err.Error())
|
|
}
|
|
|
|
convey.So(err, convey.ShouldBeNil)
|
|
convey.So(list, convey.ShouldNotBeEmpty)
|
|
|
|
})
|
|
|
|
convey.Convey("AlgorithmDetail", t, func() {
|
|
id := "d126a422-4ead-4c08-9ace-bad9451308c1"
|
|
resp, err := AlgorithmDetail(url, projectId, id)
|
|
if err != nil {
|
|
fmt.Println(err.Error())
|
|
}
|
|
fmt.Println(resp)
|
|
convey.So(err, convey.ShouldBeNil)
|
|
})
|
|
|
|
convey.Convey("AlgorithmCreate", t, func() {
|
|
requirements := make([]*model.AlgorithmResourceRequirement, 0)
|
|
param := &model.AlgorithmCreateParam{
|
|
JobConfig: &model.AlgorithmJobConfig{
|
|
Inputs: []*model.AlgorithmJobConfigInput{
|
|
{Name: ""},
|
|
},
|
|
},
|
|
Metadata: &model.AlgorithmMetadata{},
|
|
ResourceRequirements: requirements,
|
|
}
|
|
resp, err := AlgorithmCreate(url, projectId, param)
|
|
if err != nil {
|
|
fmt.Println(err.Error())
|
|
}
|
|
fmt.Println(resp)
|
|
convey.So(err, convey.ShouldBeNil)
|
|
})
|
|
|
|
}
|