Skip to content

Commit

Permalink
Revert "fix: this commit is for verification purposes only"
Browse files Browse the repository at this point in the history
This reverts commit c681e44.
  • Loading branch information
hlts2 committed Jan 22, 2025
1 parent c681e44 commit a2f9cb9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
11 changes: 1 addition & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,7 @@ func run(ctx context.Context) error {
log.Info().Interface("d", d).Msg("Created a new driver")

log.Info().Msg("Running the driver")
// return d.Run(ctx)

// TODO: The following code is for verification purposes only.
hook, err := hook.NewHook(
hook.WithNodeName(node),
)
if err != nil {
return err
}
return d.Run(ctx, hook)
return d.Run(ctx)
}

func main() {
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestCivoCSI(t *testing.T) {

var eg errgroup.Group
eg.Go(func() error {
return d.Run(ctx, nil)
return d.Run(ctx)
})

config := sanity.NewTestConfig()
Expand Down
14 changes: 1 addition & 13 deletions pkg/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import (
"os"
"path"
"path/filepath"
"time"

"github.com/civo/civo-csi/pkg/driver/hook"
"github.com/civo/civogo"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/rs/zerolog"
Expand Down Expand Up @@ -103,7 +101,7 @@ func NewTestDriver(fc *civogo.FakeClient) (*Driver, error) {
}

// Run the driver's gRPC server
func (d *Driver) Run(ctx context.Context, hook hook.Hook) error {
func (d *Driver) Run(ctx context.Context) error {
log.Debug().Str("socketFilename", d.SocketFilename).Msg("Parsing the socket filename to make a gRPC server")
urlParts, _ := url.Parse(d.SocketFilename)
log.Debug().Msg("Parsed socket filename")
Expand Down Expand Up @@ -157,16 +155,6 @@ func (d *Driver) Run(ctx context.Context, hook hook.Hook) error {
eg.Go(func() error {
go func() {
<-ctx.Done()

// TODO: The following code is for verification purposes only.
if hook != nil {
newCtx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
defer cancel()
if err := hook.PreStop(newCtx); err != nil {
log.Err(err).Msg("Failed to preStop hook")
}
}

log.Debug().Msg("Stopping gRPC because the context was cancelled")
d.grpcServer.GracefulStop()
}()
Expand Down

0 comments on commit a2f9cb9

Please sign in to comment.