Merge lp:~jonas-drange/ubuntu-system-settings/lp1616800 into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Merged
Approved by: Jonas G. Drange
Approved revision: 1703
Merged at revision: 1709
Proposed branch: lp:~jonas-drange/ubuntu-system-settings/lp1616800
Merge into: lp:ubuntu-system-settings
Diff against target: 69 lines (+32/-2)
2 files modified
plugins/system-update/click/manager_impl.cpp (+9/-2)
tests/plugins/system-update/tst_clickmanager.cpp (+23/-0)
To merge this branch: bzr merge lp:~jonas-drange/ubuntu-system-settings/lp1616800
Reviewer Review Type Date Requested Status
Ken VanDine Approve
system-apps-ci-bot continuous-integration Approve
Review via email: mp+303912@code.launchpad.net

Commit message

do not overwrite updatedAt

To post a comment you must log in.
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:1702
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/130/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1307
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/291
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1307
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/1172
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial+overlay/1172
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=yakkety/1172
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1152/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1152
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1152/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/130/rebuild

review: Approve (continuous-integration)
1703. By Jonas G. Drange

extend sync test, and add updatedAt for manually installed clicks

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/system-update/click/manager_impl.cpp'
--- plugins/system-update/click/manager_impl.cpp 2016-08-16 11:42:49 +0000
+++ plugins/system-update/click/manager_impl.cpp 2016-08-25 12:17:36 +0000
@@ -302,8 +302,15 @@
302 /* The local version of a click in the manifest, matched exactly a302 /* The local version of a click in the manifest, matched exactly a
303 a remote version in one of our db updates. */303 a remote version in one of our db updates. */
304 if (manifestUpdate->localVersion() == dbUpdate->remoteVersion()) {304 if (manifestUpdate->localVersion() == dbUpdate->remoteVersion()) {
305 m_model->setInstalled(dbUpdate->identifier(),305 // We can't know when it was updated, so now() will have to do.
306 dbUpdate->revision());306 if (!dbUpdate->updatedAt().isValid()) {
307 dbUpdate->setUpdatedAt(QDateTime::currentDateTimeUtc());
308 }
309 dbUpdate->setState(Update::State::StateInstallFinished);
310 dbUpdate->setInstalled(true);
311 dbUpdate->setDownloadId("");
312 dbUpdate->setError("");
313 m_model->update(dbUpdate);
307 found = true;314 found = true;
308 } else if (manifestUpdate->identifier() == dbUpdate->identifier()) {315 } else if (manifestUpdate->identifier() == dbUpdate->identifier()) {
309 // Fast forward the local version.316 // Fast forward the local version.
310317
=== modified file 'tests/plugins/system-update/tst_clickmanager.cpp'
--- tests/plugins/system-update/tst_clickmanager.cpp 2016-08-12 07:40:41 +0000
+++ tests/plugins/system-update/tst_clickmanager.cpp 2016-08-25 12:17:36 +0000
@@ -27,6 +27,7 @@
27#include "plugins/system-update/faketokendownloader.h"27#include "plugins/system-update/faketokendownloader.h"
28#include "plugins/system-update/faketokendownloader_factory.h"28#include "plugins/system-update/faketokendownloader_factory.h"
2929
30#include <QDateTime>
30#include <QDir>31#include <QDir>
31#include <QJsonArray>32#include <QJsonArray>
32#include <QJsonParseError>33#include <QJsonParseError>
@@ -276,6 +277,7 @@
276277
277 Q_FOREACH(auto update, markedInstalled) {278 Q_FOREACH(auto update, markedInstalled) {
278 QVERIFY(m_model->get(update)->installed());279 QVERIFY(m_model->get(update)->installed());
280 QVERIFY(m_model->get(update)->updatedAt().isValid());
279 }281 }
280 Q_FOREACH(auto update, uninstalled) {282 Q_FOREACH(auto update, uninstalled) {
281 QVERIFY(!m_model->get(update)->installed());283 QVERIFY(!m_model->get(update)->installed());
@@ -513,6 +515,27 @@
513 {515 {
514 // Verify that a SessionToken is requested even if a check has not run.516 // Verify that a SessionToken is requested even if a check has not run.
515 }517 }
518 void testSynchronizationDoesNotOverwriteUpdatedAt()
519 {
520 // Fix for lp:1616800
521 auto update = createUpdate("a", 0);
522 auto updatedAt = QDateTime(QDate(2016, 2, 29), QTime(18, 0), Qt::UTC);
523 update->setRemoteVersion("v1");
524 update->setInstalled(true);
525 update->setUpdatedAt(updatedAt);
526 m_model->add(update);
527
528 /* Trigger synchronization using data to indicate that a.0 was
529 installed. */
530 QByteArray manifest("[{"
531 "\"name\": \"a\","
532 "\"version\": \"v1\""
533 "}]");
534 m_mockmanifest->mockSuccess(JSONfromQByteArray(manifest));
535
536 auto dbUpdated = m_model->get("a", 0);
537 QCOMPARE(update->updatedAt(), dbUpdated->updatedAt());
538 }
516private:539private:
517 // Create JSON Array from a QByteArray.540 // Create JSON Array from a QByteArray.
518 QJsonArray JSONfromQByteArray(const QByteArray &byteArray)541 QJsonArray JSONfromQByteArray(const QByteArray &byteArray)

Subscribers

People subscribed via source and target branches