DepsolveJobResult: Remove unused Error and ErrorType
These fields are not set by the depsolve job, they are only set and used in tests so remove them. Errors are reported in the result.JobError Related: Related: RHEL-60125
This commit is contained in:
parent
3c2b415e53
commit
a613e8cb37
4 changed files with 0 additions and 54 deletions
|
|
@ -125,8 +125,6 @@ func mockDepsolve(t *testing.T, workerServer *worker.Server, wg *sync.WaitGroup,
|
|||
Document: sbomDoc,
|
||||
},
|
||||
},
|
||||
Error: "",
|
||||
ErrorType: worker.ErrorType(""),
|
||||
}
|
||||
|
||||
if fail {
|
||||
|
|
|
|||
|
|
@ -195,13 +195,6 @@ type DepsolveJob struct {
|
|||
SbomType sbom.StandardType `json:"sbom_type,omitempty"`
|
||||
}
|
||||
|
||||
type ErrorType string
|
||||
|
||||
const (
|
||||
DepsolveErrorType ErrorType = "depsolve"
|
||||
OtherErrorType ErrorType = "other"
|
||||
)
|
||||
|
||||
// SbomDoc represents a single SBOM document result.
|
||||
type SbomDoc struct {
|
||||
DocType sbom.StandardType `json:"type"`
|
||||
|
|
@ -212,8 +205,6 @@ type DepsolveJobResult struct {
|
|||
PackageSpecs map[string][]rpmmd.PackageSpec `json:"package_specs"`
|
||||
SbomDocs map[string]SbomDoc `json:"sbom_docs,omitempty"`
|
||||
RepoConfigs map[string][]rpmmd.RepoConfig `json:"repo_configs"`
|
||||
Error string `json:"error"`
|
||||
ErrorType ErrorType `json:"error_type"`
|
||||
JobResult
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -420,14 +420,6 @@ func (s *Server) DepsolveJobInfo(id uuid.UUID, result *DepsolveJobResult) (*JobI
|
|||
return nil, fmt.Errorf("expected %q, found %q job instead", JobTypeDepsolve, jobInfo.JobType)
|
||||
}
|
||||
|
||||
if result.JobError == nil && result.Error != "" {
|
||||
if result.ErrorType == DepsolveErrorType {
|
||||
result.JobError = clienterrors.New(clienterrors.ErrorDNFDepsolveError, result.Error, nil)
|
||||
} else {
|
||||
result.JobError = clienterrors.New(clienterrors.ErrorRPMMDError, result.Error, nil)
|
||||
}
|
||||
}
|
||||
|
||||
return jobInfo, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -640,41 +640,6 @@ func TestMixedOSBuildJob(t *testing.T) {
|
|||
require.Equal(newJobResult, newJobResultRead)
|
||||
}
|
||||
|
||||
func TestDepsolveLegacyErrorConversion(t *testing.T) {
|
||||
distroStruct := newTestDistro(t)
|
||||
arch, err := distroStruct.GetArch(test_distro.TestArchName)
|
||||
if err != nil {
|
||||
t.Fatalf("error getting arch from distro: %v", err)
|
||||
}
|
||||
server := newTestServer(t, t.TempDir(), defaultConfig, false)
|
||||
|
||||
depsolveJobId, err := server.EnqueueDepsolve(&worker.DepsolveJob{}, "")
|
||||
require.NoError(t, err)
|
||||
|
||||
_, _, _, _, _, err = server.RequestJob(context.Background(), arch.Name(), []string{worker.JobTypeDepsolve}, []string{""}, uuid.Nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
reason := "Depsolve failed"
|
||||
errType := worker.DepsolveErrorType
|
||||
|
||||
expectedResult := worker.DepsolveJobResult{
|
||||
Error: reason,
|
||||
ErrorType: errType,
|
||||
JobResult: worker.JobResult{
|
||||
JobError: clienterrors.New(clienterrors.ErrorDNFDepsolveError, reason, nil),
|
||||
},
|
||||
}
|
||||
|
||||
depsolveJobResult := worker.DepsolveJobResult{
|
||||
Error: reason,
|
||||
ErrorType: errType,
|
||||
}
|
||||
|
||||
_, err = server.DepsolveJobInfo(depsolveJobId, &depsolveJobResult)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expectedResult, depsolveJobResult)
|
||||
}
|
||||
|
||||
type testJob struct {
|
||||
main interface{}
|
||||
deps []testJob
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue