Skip to content
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

sharness: add t0040-install-many.sh #12

Merged
merged 8 commits into from
Dec 28, 2015

Conversation

chriscool
Copy link
Contributor

This is to test installing different ipfs versions.

If the added tests pass we can close issue #7 (Timeouts with v0.3.8 and v0.3.7).

@chriscool chriscool force-pushed the more-sharness-tests branch 3 times, most recently from 4218885 to 7bb7cd7 Compare December 16, 2015 16:57
@jbenet
Copy link
Member

jbenet commented Dec 16, 2015

seems like it failed. cc @whyrusleeping

@chriscool
Copy link
Contributor Author

Yeah, it fails with:

expecting success: 

        exec_docker "$DOCID" "$GUEST_IPFS_UPDATE --verbose install $VERSION" >actual 2>&1 ||

        test_fsh cat actual



> cat actual

daemon check failed: open /root/.ipfs/api: no such file or directory

installing ipfs version v0.3.10

  - using GOOS=linux and GOARCH=amd64

  - fetching "/ipns/update.ipfs.io/go-ipfs/v0.3.10/go-ipfs_v0.3.10_linux-amd64.zip"

fetching url: https://ipfs.io/ipns/update.ipfs.io/go-ipfs/v0.3.10/go-ipfs_v0.3.10_linux-amd64.zip

  - writing to /tmp/ipfs-update030874052/go-ipfs_v0.3.10_linux-amd64.zip

  - extracting binary to tempdir:  /tmp/ipfs-update480963513/ipfs-new

binary downloaded, verifying...

  - running init in '/root/.ipfs/update-staging/test196113491' with new binary

  - checking new binary outputs correct version

  - tweaking test config to avoid external interference

  - starting up daemon

  - waiting on daemon to come online

  - found api file

  - checking that we can add and cat a file

  - checking that file shows up in ipfs refs local

  - killing test daemon

success!

stashing old binary

  - moving /usr/local/bin/ipfs to /root/.ipfs/old-bin/ipfs-v0.3.7

installing new binary to /usr/local/bin/ipfs

checking if repo migration is needed...

ERROR: Migration Failed:  open /root/.ipfs/version: no such file or directory

install failed, reverting changes...

ERROR: open /root/.ipfs/version: no such file or directory 

not ok 6 - 'ipfs-update install' works for v0.3.10

It also fails locally on my machine.

@chriscool
Copy link
Contributor Author

I just added revert tests that also fail.

@chriscool
Copy link
Contributor Author

@whyrusleeping it looks to me that the following code in migrations.go should be improved:

func CheckMigration() error {
    stump.Log("checking if repo migration is needed...")
    p := util.IpfsDir()
    oldverB, err := ioutil.ReadFile(filepath.Join(p, "version"))
    if err != nil {
        return err
    }
...

When v0.3.7 is installed the version file is not created. It is only created when "ipfs init" is run.

@chriscool
Copy link
Contributor Author

I fixed a few things in migrations.go, main.go and revert.go, so that the tests now pass.

@@ -14,13 +12,11 @@ import (

func CheckMigration() error {
stump.Log("checking if repo migration is needed...")
p := util.IpfsDir()
oldverB, err := ioutil.ReadFile(filepath.Join(p, "version"))
oldver, err := GetCurrentVersion()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this will work right. The version returned here is the ipfs binary version, and we're looking for the version of the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erroring out when the "version" file is not there was wrong anyway, because the "version" file is created by some versions of IPFS only when ipfs init is run.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed. we should have some function that maps ipfs version to a repo version for the versions we can't call ipfs version --repo on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but maybe that is a separate topic and you can have a different PR do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, now that i think about it. if theres no version file, theres no repo to migrate. So we can just short circuit out of this check in that case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can change it to something like:

vfilePath := filepath.Join(p, "version")
if _, err := os.Stat(vfilePath); err == os.ErrNotExist {
    VLog("  - no prexisting repo to migrate")
    return nil
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I just pushed a new version of this patch series that does something like that.

@whyrusleeping
Copy link
Member

@chriscool i'll push a fix to this branch for you for the repo version thing.

@chriscool
Copy link
Contributor Author

I had to push another version of the series, because as PR #15 had been merged, tests didn't pass anymore.

@whyrusleeping
Copy link
Member

this LGTM

whyrusleeping added a commit that referenced this pull request Dec 28, 2015
sharness: add t0040-install-many.sh
@whyrusleeping whyrusleeping merged commit 9b31c27 into ipfs:master Dec 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants