diff --git a/Makefile b/Makefile index 38cc2cecaf950d3ad1401a9308b99aeb779de7d7..9d9fbea7f9cf5a64bea0f624810f36643a0f2ee3 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,9 @@ agent: ${ENV} ${GO_BUILD} -tags "osusergo netgo static_build" -ldflags '$(LDFLAGS)' $(BUILDFLAGS) -o bin/os-agent cmd/agent/main.go strip bin/os-agent +test: + $(GO) test $(shell go list ./... ) -race -cover -count=1 -timeout=300s + # Install CRDs into a cluster install: manifests kubectl apply -f confg/crd diff --git a/cmd/agent/server/docker_image_test.go b/cmd/agent/server/docker_image_test.go index cc77a2bc5560ce6c05afbb436055ab88208f14bc..9987939390dbe33dbc3a97d026352d0fc4002d24 100644 --- a/cmd/agent/server/docker_image_test.go +++ b/cmd/agent/server/docker_image_test.go @@ -52,24 +52,3 @@ func TestpullOSImage(t *testing.T) { } defer os.RemoveAll("/persist") } - -func TestrandStringBytesRmndr(t *testing.T) { - type args struct { - n int - } - tests := []struct { - name string - args args - want string - }{ - {name: "normal", args: args{n: 6}, want: ""}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := randStringBytesRmndr(tt.args.n); got == "" { - t.Errorf("randStringBytesRmndr() not generatre random string") - } - - }) - } -} diff --git a/cmd/proxy/controllers/os_controller.go b/cmd/proxy/controllers/os_controller.go index 09e58f9db9dadc081dd0550852374a6f0103a958..fdd31eaafbae2c5daadf80c16b692e95ad178d0d 100644 --- a/cmd/proxy/controllers/os_controller.go +++ b/cmd/proxy/controllers/os_controller.go @@ -15,6 +15,7 @@ package controllers import ( "context" + "fmt" "os" corev1 "k8s.io/api/core/v1" @@ -123,6 +124,8 @@ func (r *OSReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Re if err := r.Connection.RollbackSpec(); err != nil { return values.RequeueNow, err } + default: + return values.RequeueNow, fmt.Errorf("operation %s cannot be recognized", opsType) } } return values.Requeue, nil diff --git a/scripts/bootloader.sh b/scripts/bootloader.sh index 5760f3dc739df816aadb6c5dfa3cfeb37220cce1..16c5713dfcac23ec41f3d5a72763e5f0b6722205 100644 --- a/scripts/bootloader.sh +++ b/scripts/bootloader.sh @@ -6,14 +6,6 @@ ARCH=`arch` function install_grub2_x86 () { - # make boot.img/core.img and setup, to support legacy boot mode - GRUBNAME=$(which grub2-install) - echo "Installing GRUB2..." - GRUB_OPTS=${GRUB_OPTS:-"--force"} - GRUB_OPTS="$GRUB_OPTS --target=i386-pc" - - $GRUBNAME --modules="biosdisk part_msdos" $GRUB_OPTS $DEVICE - # make efi file, and save in FAT16 partition, to support UEFI boot mode cp -r /usr/lib/grub/x86_64-efi boot/efi/EFI/openEuler eval "grub2-mkimage -d /usr/lib/grub/x86_64-efi -O x86_64-efi --output=/boot/efi/EFI/openEuler/grubx64.efi '--prefix=(,gpt1)/EFI/openEuler' fat part_gpt part_msdos linux"