Skip to content

Commit

Permalink
feat(act): download after patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferenc Sárai committed Jul 29, 2024
1 parent 3b7d077 commit cec4575
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions pkg/check/act/act.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,6 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int

c.logger.Info("ACT grantees listed")

// download act file
pubk := publisher
size1, hash1, err1 := client1.DownloadActFile(ctx, fileAddress, &api.DownloadOptions{Act: &act, ActPublicKey: &pubk, ActHistoryAddress: &history, ActTimestamp: &timestamp})
if err1 != nil {
return fmt.Errorf("node %s: %w", nodeName1, err1)
}

if !bytes.Equal(file.Hash(), hash1) {
c.logger.Infof("Node %s. ACT file hash not equal. Uploaded size: %d Downloaded size: %d File: %s", nodeName1, file.Size(), size1, file.Address().String())
return errors.New("ACT file retrieval - hash error")
}

c.logger.Info("ACT file downloaded with grantee")

// patch grantees
pFile := bee.NewBufferFile("grantees-patch.json", bytes.NewBuffer([]byte(`{
"add": [
Expand Down Expand Up @@ -211,6 +197,20 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int
}
c.logger.Info("ACT grantees listed after patch")

// download act file
pubk := pubk1
size1, hash1, err1 := client1.DownloadActFile(ctx, fileAddress, &api.DownloadOptions{Act: &act, ActPublicKey: &pubk, ActHistoryAddress: &history, ActTimestamp: &timestamp})
if err1 != nil {
return fmt.Errorf("node %s: %w", nodeName1, err1)
}

if !bytes.Equal(file.Hash(), hash1) {
c.logger.Infof("Node %s. ACT file hash not equal. Uploaded size: %d Downloaded size: %d File: %s", nodeName1, file.Size(), size1, file.Address().String())
return errors.New("ACT file retrieval - hash error")
}

c.logger.Info("ACT file downloaded with grantee")

c.logger.Info("ACT test completed")

return
Expand Down

0 comments on commit cec4575

Please sign in to comment.