Skip to content

Commit

Permalink
Merge branch 'master' into issue/2634
Browse files Browse the repository at this point in the history
  • Loading branch information
bassosimone committed Nov 30, 2023
2 parents 64b43f0 + 0d55aa7 commit d5f0639
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
23 changes: 15 additions & 8 deletions internal/experiment/webconnectivitylte/analysisclassic.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,23 @@ func analysisClassicDNSConsistency(woa *minipipeline.WebAnalysis) optional.Value
func (tk *TestKeys) setHTTPDiffValues(woa *minipipeline.WebAnalysis) {
const bodyProportionFactor = 0.7
if !woa.HTTPFinalResponseDiffBodyProportionFactor.IsNone() {
tk.BodyLengthMatch = optional.Some(woa.HTTPFinalResponseDiffBodyProportionFactor.Unwrap() > bodyProportionFactor)
value := woa.HTTPFinalResponseDiffBodyProportionFactor.Unwrap() > bodyProportionFactor
tk.BodyLengthMatch = &value

Check failure on line 72 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment

Check failure on line 72 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment
}

if !woa.HTTPFinalResponseDiffUncommonHeadersIntersection.IsNone() {
tk.HeadersMatch = optional.Some(len(woa.HTTPFinalResponseDiffUncommonHeadersIntersection.Unwrap()) > 0)
value := len(woa.HTTPFinalResponseDiffUncommonHeadersIntersection.Unwrap()) > 0
tk.HeadersMatch = &value

Check failure on line 77 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment

Check failure on line 77 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment
}

if !woa.HTTPFinalResponseDiffStatusCodeMatch.IsNone() {
value := woa.HTTPFinalResponseDiffStatusCodeMatch.Unwrap()
tk.StatusCodeMatch = &value

Check failure on line 82 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment

Check failure on line 82 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment
}

tk.StatusCodeMatch = woa.HTTPFinalResponseDiffStatusCodeMatch
if !woa.HTTPFinalResponseDiffTitleDifferentLongWords.IsNone() {
tk.TitleMatch = optional.Some(len(woa.HTTPFinalResponseDiffTitleDifferentLongWords.Unwrap()) <= 0)
value := len(woa.HTTPFinalResponseDiffTitleDifferentLongWords.Unwrap()) <= 0
tk.TitleMatch = &value

Check failure on line 87 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment

Check failure on line 87 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

cannot use &value (value of type *bool) as optional.Value[bool] value in assignment
}
}

Expand All @@ -99,14 +106,14 @@ var _ analysisClassicTestKeysProxy = &TestKeys{}

// httpDiff implements analysisClassicTestKeysProxy.
func (tk *TestKeys) httpDiff() bool {
if !tk.StatusCodeMatch.IsNone() && tk.StatusCodeMatch.Unwrap() {
if !tk.BodyLengthMatch.IsNone() && tk.BodyLengthMatch.Unwrap() {
if tk.StatusCodeMatch != nil && *tk.StatusCodeMatch {

Check failure on line 109 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

invalid operation: tk.StatusCodeMatch != nil (mismatched types optional.Value[bool] and untyped nil)

Check failure on line 109 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

invalid operation: cannot indirect tk.StatusCodeMatch (variable of type optional.Value[bool])

Check failure on line 109 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

invalid operation: tk.StatusCodeMatch != nil (mismatched types optional.Value[bool] and untyped nil)

Check failure on line 109 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

invalid operation: cannot indirect tk.StatusCodeMatch (variable of type optional.Value[bool])
if tk.BodyLengthMatch != nil && *tk.BodyLengthMatch {

Check failure on line 110 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

invalid operation: tk.BodyLengthMatch != nil (mismatched types optional.Value[bool] and untyped nil)

Check failure on line 110 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

invalid operation: cannot indirect tk.BodyLengthMatch (variable of type optional.Value[bool])

Check failure on line 110 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

invalid operation: tk.BodyLengthMatch != nil (mismatched types optional.Value[bool] and untyped nil)

Check failure on line 110 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

invalid operation: cannot indirect tk.BodyLengthMatch (variable of type optional.Value[bool])
return false
}
if !tk.HeadersMatch.IsNone() && tk.HeadersMatch.Unwrap() {
if tk.HeadersMatch != nil && *tk.HeadersMatch {

Check failure on line 113 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

invalid operation: tk.HeadersMatch != nil (mismatched types optional.Value[bool] and untyped nil)

Check failure on line 113 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / test

invalid operation: cannot indirect tk.HeadersMatch (variable of type optional.Value[bool])

Check failure on line 113 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

invalid operation: tk.HeadersMatch != nil (mismatched types optional.Value[bool] and untyped nil)

Check failure on line 113 in internal/experiment/webconnectivitylte/analysisclassic.go

View workflow job for this annotation

GitHub Actions / measure_coverage

invalid operation: cannot indirect tk.HeadersMatch (variable of type optional.Value[bool])
return false
}
if !tk.TitleMatch.IsNone() && tk.TitleMatch.Unwrap() {
if tk.TitleMatch != nil && *tk.TitleMatch {
return false
}
// fallthrough
Expand Down
2 changes: 1 addition & 1 deletion internal/experiment/webconnectivitylte/analysiscore.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (

// AnalysisEngineFn is the function that runs the analysis engine for
// processing and scoring measurements collected by LTE.
var AnalysisEngineFn func(tk *TestKeys, logger model.Logger) = AnalysisEngineClassic
var AnalysisEngineFn func(tk *TestKeys, logger model.Logger) = AnalysisEngineOrig

// analysisToplevel is the toplevel function that analyses the results
// of the experiment once all network tasks have completed.
Expand Down
7 changes: 3 additions & 4 deletions internal/experiment/webconnectivitylte/analysisdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/ooni/probe-cli/v3/internal/model"
"github.com/ooni/probe-cli/v3/internal/netxlite"
"github.com/ooni/probe-cli/v3/internal/optional"
)

const (
Expand Down Expand Up @@ -62,13 +63,11 @@ func (tk *TestKeys) analysisDNSToplevel(logger model.Logger, lookupper model.Geo
tk.analysisDNSUnexpectedAddrs(logger, lookupper)
if tk.DNSFlags != 0 {
logger.Warn("DNSConsistency: inconsistent")
//v := "inconsistent"
//tk.DNSConsistency = &v
tk.DNSConsistency = optional.Some("inconsistent")
tk.BlockingFlags |= analysisFlagDNSBlocking
} else {
logger.Info("DNSConsistency: consistent")
//v := "consistent"
//tk.DNSConsistency = &v
tk.DNSConsistency = optional.Some("consistent")
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/experiment/webconnectivitylte/testkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func NewTestKeys() *TestKeys {
DNSFlags: 0,
DNSExperimentFailure: nil,
DNSConsistency: optional.None[string](),
HTTPExperimentFailure: optional.None[string](),
HTTPExperimentFailure: nil,
BlockingFlags: 0,
NullNullFlags: 0,
BodyLengthMatch: optional.None[bool](),
Expand Down

0 comments on commit d5f0639

Please sign in to comment.