Commit Graph

373 Commits

Author SHA1 Message Date
Stephan Seidt
afbdedb469 config set: test setting with null & not-defined parent
This adds a failing for the case described in #1561

License: MIT
Signed-off-by: Stephan Seidt <evilhackerdude@gmail.com>
2015-08-13 19:41:41 +07:00
Juan Batiz-Benet
978c9fa16f cmds/add: use dagutils.Editor, like patch
This changes the pin behavior. It uses the filenames given through
the api, and allows files to be streamed faltly (not a hierarchy),
which is easier for other things (like vinyl in node-ipfs-api land).
Files can also be entirely out of order, and the garbage intermediate
directories will not be pinned (gc-ed later).

The changes also mean the output of add has changed slightly-- it
no longer shows the local path added, but rather the dag path
relative to the added roots. This is a small difference, but changes
tests.

The dagutils.Editor creates a lot of chaff (intermediate objects)
along the way. Wonder how we might minimize the writes to the
datastore...

This commit also removes the "NilRepo()" part of the --only-hash
mode. We need to store at least in an in-mem repo/datastore because
otherwise the dagutils.Editor breaks.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-12 08:24:06 +02:00
Juan Batiz-Benet
f105ce439f get: fix bug + improvements
up until now there has been a very annoying bug with get, we would
get halting behavior. I'm not 100% sure this commit fixes it,
but it should. It certainly fixes others found in the process of
digging into the get / tar extractor code. (wish we could repro
the bug reliably enough to make a test case).

This is a much cleaner tar writer. the ad-hoc, error-prone synch
for the tar reader is gone (with i believe was incorrect). it is
replaced with a simple pipe and bufio. The tar logic is now in
tar.Writer, which writes unixfs dag nodes into a tar archive (no
need for synch here). And get's reader is constructed with DagArchive
which sets up the pipe + bufio.

NOTE: this commit also changes this behavior of `get`:
When retrieving a single file, if the file exists, get would fail.
this emulated the behavior of wget by default, which (without opts)
does not overwrite if the file is there. This change makes get
fail if the file is available locally. This seems more intuitive to
me as expected from a unix tool-- though perhaps it should be
discussed more before adopting.

Everything seems to work fine, and i have not been able to reproduce
the get halt bug.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-05 09:50:33 +02:00
Juan Batiz-Benet
741cf7e793 sharness/t009-get: fix space/tabs
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-05 09:47:58 +02:00
Juan Batiz-Benet
b858928662 unixfs/tar: cleaned up reader code
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-08-05 09:46:58 +02:00
Juan Batiz-Benet
5f59556ff9 add -w comprehensive tests
made many more tests for ipfs add -w

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-29 04:08:08 -07:00
Juan Batiz-Benet
431d6a5a14 added random-files tool for testing
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-29 03:18:24 -07:00
Juan Batiz-Benet
6e6badf105 add -w: fix to work correctly with dirs.
this commit changes the behavior of ipfs add -w:

- it makes it able to work with ipfs add -r <dir>
- instead of hacking around the add, we simply just add a wrapper
  directory around the whole result of the add. this means that
  ipfs add -w calls will output _two_ lines, but this is actually
  more correct than outputting one line, as two objects were added.
  this _may_ break scripts out there which expect the output to
  look a certain way. we should consider whether the old output is
  more _useful_ (even if less in-line with the model.)

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-29 02:30:08 -07:00
Jeromy
314f7bbfea space out sharness test calls
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-28 15:00:07 -07:00
Jeromy
194eb7c0dc more tests and better path handling in object
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-28 15:00:07 -07:00
Jeromy
bfe4e4be4f let rm understand paths
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-28 15:00:07 -07:00
Jeromy
870df2431a allow patch to optionally create intermediate dirs
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-28 15:00:07 -07:00
Shaun Bruce
c175700dea Better error message on unrecognized command
Closes issue #1436

License: MIT
Signed-off-by: Shaun Bruce <shaun.m.bruce@gmail.com>
2015-07-28 09:20:53 -06:00
Juan Batiz-Benet
490ed41c45 sharness/ipfs refs bigger tests
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 06:14:20 -07:00
gatesvp
8fe7d2f571 Fix refs -r -u for #1211
License: MIT
Signed-off-by: Gaetan Voyer-Perrault <gatesvp@gmail.com>
2015-07-28 06:14:20 -07:00
Juan Batiz-Benet
a5521fcc76 sharness/repo: fix pinning test
looks like the test was broken by GC-ing everything.
the pin expects $HASH to still be there.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-28 06:14:13 -07:00
rht
eb45082103 Add reversible gc test
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-07-28 09:47:15 +07:00
Jeromy
138198e786 print output on test failure for t0081
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-27 18:34:37 -07:00
Jeromy
bb3a75aa08 remove context from context
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-20 20:53:06 -07:00
Jeromy
f9f3c6a527 make offline commands respect timeout
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-20 14:34:16 -07:00
Jeromy
5711eb8cd9 better test of failure case
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-14 13:28:22 -07:00
Jeromy
4cce6f8adf add sharness test to check object stat with no leading /ipfs/
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-14 12:28:38 -07:00
gatesvp
e55a130b49 Add hidden file support to add
License: MIT
Signed-off-by: Gaetan Voyer-Perrault <gatesvp@gmail.com>
2015-07-09 04:07:34 -07:00
Henry
1b16712b5a assets: seed gateway index assets on 'ipfs init'
License: MIT
Signed-off-by: Henry <cryptix@riseup.net>

t0080-repo.sh: added gateway assets to pinning tests

License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-07-04 01:47:07 +02:00
Henry
358d04c606 sharness/t0110-gateway: add simple 404 check for non existent file
License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-07-04 00:51:42 +02:00
Juan Batiz-Benet
8143d381c1 Merge pull request #1441 from rht/path-validate
Remove redundant path validation
2015-07-03 15:23:17 -07:00
rht
44245fe015 Add test to detect invalid path
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2015-07-04 02:50:15 +07:00
Henry
624c6e8fe5 assets: fix typo
closes #1343

License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-07-03 10:59:08 +02:00
Henry
5fbf1e7416 assets: switch to go-bindata
License: MIT
Signed-off-by: Henry <cryptix@riseup.net>
2015-07-03 09:52:08 +02:00
Juan Batiz-Benet
c595cf8ae0 config: DialBlocklist -> Swarm.AddrFilters
This commit changes the DialBlocklist key to be under the key
Swarm.AddrFilters instead.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-02 16:11:46 -07:00
Juan Batiz-Benet
a119b72243 t0141-addfilter: check init has no filters
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-07-02 16:10:30 -07:00
Jeromy
57d7a443a0 test dialblocklist loading from config
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-07-02 13:38:15 -07:00
Jeromy
7cc73f7b86 add command to manipulate address filters and a sharness test for them
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-30 18:25:34 -07:00
Juan Batiz-Benet
6b8e9f51fe fix t0061-daemon-opts.sh nc wait
fix the nc wait. the issue was that stdin needs to remain _open_
but not receive any input for some time. If stdin receives (invalid)
input or closes, the other side terminates the connection before
writing out the muxer frames + identify handshake.

This commit also changes the use of `!` for `test_must_fail`

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:43 -07:00
Juan Batiz-Benet
f300e97c50 added sharness/t0061-daemon-opts
Test odd daemon options, like:
- unrestricted-api
- disable-transport-encryption (known breakage atm)

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:43 -07:00
Juan Batiz-Benet
9716018ca5 daemon output includes swarm addresses
daemon output now includes initial swarm addresses. this is not a
full solution, as a change in network will not trigger re-printing.
We need a good way to do that.

This made me re-think how we're outputting these messages, perhaps
we should be throwing them as log.Events, and capturing some with
a special keyword to output to the user on stdout. Things like
network addresses being rebound, NATs being holepunched, external
network addresses being figured out, connections established, etc
may be valuable events to show the user. Of course, these should be
very few, as a noisy daemon is an annoying daemon.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:43 -07:00
Juan Batiz-Benet
500f51300d ipfs swarm addrs local - show local addrs
Add a command to return local addresses.

License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:42 -07:00
Juan Batiz-Benet
748d25f473 t0060-daemon: test transport is encrypted
License: MIT
Signed-off-by: Juan Batiz-Benet <juan@benet.ai>
2015-06-26 23:36:42 -07:00
Christian Couder
1a77297182 t0060: export IPFS_PATH
IPFS_PATH should really be exported to make sure it is
available to the ipfs binary.

It looks like sharness tests fail otherwise on CircleCi.

License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2015-06-26 02:07:57 -07:00
Juan Batiz-Benet
ac7d25c2cc Merge pull request #1423 from ipfs/test/only-hash
add test for only-hash to ensure no blocks are added to datastore
2015-06-25 14:07:03 -07:00
Jeromy Johnson
0332f3dbaa Merge pull request #1348 from ipfs/tk/unixfs-ls
Add 'ipfs file ls …'
2015-06-25 10:03:52 -07:00
Jeromy
53dee3c64d add test for only-hash to ensure no blocks are added to datastore
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-25 09:33:47 -07:00
Jeromy
60ad7a5afc sharness tests for --only-hash
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-23 09:04:31 -07:00
W. Trevor King
4acab79d66 core/commands/unixfs/ls: Explicitily record stat in LsObject
Instead of abusing a LsLink for non-directory objects [1].

[1]: https://github.com/ipfs/go-ipfs/pull/1348#discussion_r32680669

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
5fd4812b20 core/commands/unixfs/ls.go: Fix (and test) single-directory listing
We don't want to prefix these results with the argument.  If there was
only one argument, the unprefixed results are still explicit.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
7fc2410d95 core/commands/unixfs/ls: Hash-map for Objects
Discussion with Juan on IRC ([1] through [2]) lead to this adjusted
JSON output.  Benefits over the old output include:

* deduplication (we only check the children of a given Merkle node
  once, even if multiple arguments resolve to that hash)

* alphabetized output (like POSIX's ls).  As a side-effect of this
  change, I'm also matching GNU Coreutils' ls output (maybe in POSIX?)
  by printing an alphabetized list of non-directories (one per line)
  first, with alphabetized directory lists afterwards.

[1]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41725570&page=5
[2]: https://botbot.me/freenode/ipfs/2015-06-12/?msg=41726547&page=5

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
f0a0ac1b83 core/commands/unixfs/ls: Use a stringified type name
This doesn't affect the text output, which was already using a
stringified name.  The earlier stringification does change the JSON
output from an enumeration integer (e.g. 2) to the string form
(e.g. "File").  If/when we transition to Merkle-object types named by
their hash, we will probably want to revisit this and pass both the
type hash and human-readable-but-collision-prone name on to clients.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:47 -07:00
W. Trevor King
c9733c5da7 core/commands/unixfs/ls: Set Argument in JSON output
Change the approach to the directory-header control so we can set the
Argument value in the JSON response.

Stripping the trailing newline from the JSON output is annoying, but
looking over [1] I saw no easy way to add a newline to the JSON
output.  And with the general framework that commands/ attempts to be,
it feels a bit funny to customize the JSON output for a command-line
program.  Perhaps a workable solution is to have the command-line
client append newlines to any output that otherwise lacks them?  But
that seems like a change best left to a separate series.

[1]: http://golang.org/pkg/encoding/json/

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
2015-06-20 13:34:44 -07:00
Jeromy Johnson
7d254aef20 Merge pull request #1404 from ipfs/feat/patch-path
allow patch add-link to add at a path
2015-06-19 22:01:57 -07:00
Jeromy
d585e20ebc allow patch add-link to add at a path
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2015-06-19 20:45:20 -07:00