Fix the pipeline cubefs-ci error problem

Signed-off-by: baijiaruo <huyao2@oppo.com>
This commit is contained in:
baijiaruo 2023-02-15 17:28:20 +08:00 committed by leonrayang
parent d4226d3169
commit 3d06fb3789
9 changed files with 84 additions and 67 deletions

View File

@ -239,13 +239,12 @@ pre_build() {
}
run_test() {
pre_build
# pre_build_server
pre_build_server
pushd $SrcPath >/dev/null
echo -n "${TPATH}"
# go test $MODFLAGS -ldflags "${LDFlags}" -cover ./master
go test $(go list ./... | grep -v depends)
go test -cover -v -coverprofile=cover.output $(go list ./... | grep -v depends | grep -v master) | tee cubefs_unittest.output
ret=$?
popd >/dev/null
exit $ret

View File

@ -1,8 +1,8 @@
package console
import (
"github.com/shurcooL/vfsgen"
"log"
//"github.com/shurcooL/vfsgen"
//"log"
"net/http"
"path"
"runtime"
@ -13,18 +13,18 @@ func TestMakeHtml2GoBin(t *testing.T) {
//when you need rebuild html . please open it
return
/*
assets := getAssets()
assets := getAssets()
err := vfsgen.Generate(assets, vfsgen.Options{
PackageName: "console",
BuildTags: "!dev",
VariableName: "Assets",
})
err := vfsgen.Generate(assets, vfsgen.Options{
PackageName: "console",
BuildTags: "!dev",
VariableName: "Assets",
})
if err != nil {
log.Fatalln(err)
}
if err != nil {
log.Fatalln(err)
}*/
}
func getAssets() http.FileSystem {

View File

@ -1,9 +1,9 @@
package console
import (
"github.com/cubefs/cubefs/master"
"github.com/cubefs/cubefs/util/config"
"github.com/cubefs/cubefs/util/log"
// "github.com/cubefs/cubefs/master"
// "github.com/cubefs/cubefs/util/config"
// "github.com/cubefs/cubefs/util/log"
"testing"
)
@ -11,51 +11,51 @@ func TestServer(t *testing.T) {
return
if _, err := log.InitLog("/tmp", "console", log.DebugLevel, nil); err != nil {
panic(err)
}
// if _, err := log.InitLog("/tmp", "console", log.DebugLevel, nil); err != nil {
// panic(err)
// }
// start master server
cfg := config.LoadConfigString(`{
"role": "master",
"ip": "127.0.0.1",
"listen": "8080",
"prof":"10088",
"id":"1",
"peers": "1:127.0.0.1:8080",
"retainLogs":"20000",
"tickInterval":500,
"electionTick":6,
"logDir": "/tmp/chubaofs/Logs",
"walDir":"/tmp/chubaofs/raft",
"storeDir":"/tmp/chubaofs/rocksdbstore",
"clusterName":"chubaofs"
}`)
// // start master server
// cfg := config.LoadConfigString(`{
// "role": "master",
// "ip": "127.0.0.1",
// "listen": "8080",
// "prof":"10088",
// "id":"1",
// "peers": "1:127.0.0.1:8080",
// "retainLogs":"20000",
// "tickInterval":500,
// "electionTick":6,
// "logDir": "/tmp/chubaofs/Logs",
// "walDir":"/tmp/chubaofs/raft",
// "storeDir":"/tmp/chubaofs/rocksdbstore",
// "clusterName":"chubaofs"
// }`)
mserver := master.NewServer()
if err := mserver.Start(cfg); err != nil {
panic(err)
}
// mserver := master.NewServer()
// if err := mserver.Start(cfg); err != nil {
// panic(err)
// }
go func() {
mserver.Sync()
}()
// go func() {
// mserver.Sync()
// }()
// start console server
cfg = config.LoadConfigString(`{
"role": "master",
"listen": "8989",
"masterAddr": ["127.0.0.1:8080"],
"monitor_addr" :"http://cfsthanos-yf01.cfsmon.svc.zyx02.n.jd.local",
"monitor_app": "cfs",
"monitor_cluster": "spark"
}`)
// // start console server
// cfg = config.LoadConfigString(`{
// "role": "master",
// "listen": "8989",
// "masterAddr": ["127.0.0.1:8080"],
// "monitor_addr" :"http://cfsthanos-yf01.cfsmon.svc.zyx02.n.jd.local",
// "monitor_app": "cfs",
// "monitor_cluster": "spark"
// }`)
server := NewServer()
if err := server.Start(cfg); err != nil {
panic(err)
}
server.Sync()
// server := NewServer()
// if err := server.Start(cfg); err != nil {
// panic(err)
// }
// server.Sync()
}
type graphErr struct {

View File

@ -31,8 +31,6 @@ func requestDoExtentRepair() (err error) {
default:
return
}
return
}
func fininshDoExtentRepair() {

17
env.sh Normal file
View File

@ -0,0 +1,17 @@
# Copyright 2023 The CubeFS Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
CURRENT_DIR=`pwd`
export CGO_CFLAGS="-I${CURRENT_DIR}/depends/snappy-1.1.7 -I${CURRENT_DIR}/depends/rocksdb-5.9.2/include"
export CGO_FFLAGS="-g -O2"
export CGO_LDFLAGS="-lstdc++ -lm -lz -lbz2 -llz4 -lzstd -L${CURRENT_DIR}/build/out/snappy -lsnappy -L${CURRENT_DIR}/build/out/rocksdb -lrocksdb -ldl"

View File

@ -43,7 +43,6 @@ func createDataPartition(vol *Vol, count int, t *testing.T) {
}
func getDataPartition(id uint64, t *testing.T) {
reqURL := fmt.Sprintf("%v%v?id=%v",
hostAddr, proto.AdminGetDataPartition, id)
fmt.Println(reqURL)

View File

@ -2,9 +2,10 @@ package master
import (
"fmt"
"github.com/cubefs/cubefs/util"
"testing"
"time"
"github.com/cubefs/cubefs/util"
)
func createDataNodeForTopo(addr, zoneName string, ns *nodeSet) (dn *DataNode) {
@ -75,6 +76,7 @@ func TestAllocZones(t *testing.T) {
zoneName1 := "zone1"
zone1 := newZone(zoneName1)
nodeSet1 := newNodeSet(c, 1, 6, zoneName1)
zone1.putNodeSet(nodeSet1)
topo.putZone(zone1)
topo.putDataNode(createDataNodeForTopo(mds1Addr, zoneName1, nodeSet1))
@ -83,6 +85,7 @@ func TestAllocZones(t *testing.T) {
zoneName2 := "zone2"
zone2 := newZone(zoneName2)
nodeSet2 := newNodeSet(c, 2, 6, zoneName2)
zone2.putNodeSet(nodeSet2)
topo.putZone(zone2)
topo.putDataNode(createDataNodeForTopo(mds3Addr, zoneName2, nodeSet2))
@ -91,6 +94,7 @@ func TestAllocZones(t *testing.T) {
zoneName3 := "zone3"
zone3 := newZone(zoneName3)
nodeSet3 := newNodeSet(c, 3, 6, zoneName3)
zone3.putNodeSet(nodeSet3)
topo.putZone(zone3)
topo.putDataNode(createDataNodeForTopo(mds5Addr, zoneName3, nodeSet3))

View File

@ -71,7 +71,6 @@ func (mp *metaPartition) UpdateXAttr(req *proto.UpdateXAttrRequest, p *Packet) (
p.PacketOkReply()
return
}
return
}
func (mp *metaPartition) SetXAttr(req *proto.SetXAttrRequest, p *Packet) (err error) {

View File

@ -20,9 +20,6 @@ import (
"encoding/json"
"encoding/xml"
"fmt"
"github.com/cubefs/cubefs/metanode"
"github.com/cubefs/cubefs/sdk/data/blobstore"
"github.com/cubefs/cubefs/sdk/master"
"hash"
"io"
"os"
@ -31,6 +28,10 @@ import (
"sync"
"syscall"
"github.com/cubefs/cubefs/metanode"
"github.com/cubefs/cubefs/sdk/data/blobstore"
"github.com/cubefs/cubefs/sdk/master"
"crypto/md5"
"time"
@ -1517,7 +1518,7 @@ func (v *Volume) readEbs(inode, inodeSize uint64, path string, writer io.Writer,
}
ctx := context.Background()
context.WithValue(ctx, "objectnode", 1)
_ = context.WithValue(ctx, "objectnode", 1)
reader := v.getEbsReader(inode)
var n int
var tmp = make([]byte, 2*v.ebsBlockSize)