-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix merge integration test #3552
Conversation
MDrakos
commented
Oct 21, 2024
•
edited by github-actions
bot
Loading
edited by github-actions
bot
DX-3115 Nightly failure: TestPullIntegrationTestSuite/TestMergeBuildScript |
if err := script.UnmarshalBuildExpression(resp.Commit.Expression); err != nil { | ||
return nil, errs.Wrap(err, "failed to parse build expression") | ||
} | ||
script.SetAtTime(time.Time(resp.Commit.AtTime)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This update is to follow the same structure as here: https://github.com/ActiveState/cli/blob/master/pkg/platform/model/buildplanner/build.go#L113
It appears we want to the buildscript at_time
to be the commit at_time
even if the buildscript has it's own time set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should fix this issue closer to the root. The issue here is that UnmarshalBuildExpression is apparently overriding the AtTime. We should fix that.
We might still be setting at time in the raw representation, we should move that out of raw and just set it on the buildscript struct itself. Raw effectively represents the build expression, which does not contain the at time at all.
There was a time before we had |
As per our discussion at stand the This change ensures that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the code now, I realize that this should just be an update to our testing code. The reason the test was failing is we were essentially testing how we want things to work with new buildscripts, but it was failing cause it was dealing with an old builscript. The solution with old buildscripts was appropriate: Take the at_time value, and record it on the buildscript level. Next time the user commits either it is bumped or at the very least it will be recorded on the commit level.
So sorry for going back on what we discussed during stand; but I think the fix here ought to be no code changes to anything but the integration test. And the integration test fix in theory would just be to bump the time stamp on the commit that it starts from for the comparison (ie. so it uses a build expression without the at time value hardcoded on it).
From our discussion the following points are how we want to handle the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is meeting the criteria:
- We respect the hardcoded at_time value
Because we are always returning atTime
when it is set. Which will always be the case. I think you are not seeing this in your tests because you are likely still setting atTime before unmarshalling.
Essentially the following test should pass (pseudo code):
func TestLegacyAtTime(t *testing.T) {
bs := newBuildScript()
err := bs.UnmarshalBuildExpression(bexp)
require.NoError(t, err)
err := bs.SetAtTime(bogusValue)
require.ErrorAs(err, ErrAtTimeAlreadySet)
require.Equal(t, bs.AtTime(), buildExpressionAtTime)
}
So that would be asserting that the build expression atTime is preserved and overrides the commit atTime.
The error check on SetAtTime is just an in-the-moment solution to the problem of "I as a developer do not need special knowledge". Because when working with legacy atTime values it straight up isn't appropriate to override the at time with that of the commit. I think erroring out in this case is ok, because then at least the failure will be obvious to the developer and they can then handle it better (eg. ignore that type of error and move on).
@Naatan You're right I misinterpreted that point. I didn't realize we want to retain the solve node's |
internal/runners/install/install.go
Outdated
@@ -114,6 +114,7 @@ func (i *Install) Run(params Params) (rerr error) { | |||
var oldCommit *bpModel.Commit | |||
var reqs requirements | |||
var ts time.Time | |||
var override bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for the install action we always want to override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, so anytime we make a change we want to update the timestamp? I was under the impression that we want to preserve the timestamp in the solve node and I was only bumping it when the user explicitly passed the --ts
flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only want to preserve it when we retrieve the commit. Once we're acting on the buildscript (ie. making changes) the existing timestamp should always be overwritten.