diff mbox series

[ovs-dev] tests: Skip OVN test if truncate command not found

Message ID 20170911193711.8532-1-aserdean@ovn.org
State Not Applicable
Headers show
Series [ovs-dev] tests: Skip OVN test if truncate command not found | expand

Commit Message

Alin-Gabriel Serdean Sept. 11, 2017, 7:37 p.m. UTC
Test: "testing ovn -- ensure one gw controller restart in HA doesn't
bounce the master" uses the command `truncate`.

Skip the test if the command is not found.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
---
 tests/ovn.at | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Michelson Sept. 11, 2017, 7:59 p.m. UTC | #1
On Mon, Sep 11, 2017 at 2:37 PM Alin Gabriel Serdean <aserdean@ovn.org>
wrote:

> Test: "testing ovn -- ensure one gw controller restart in HA doesn't
> bounce the master" uses the command `truncate`.
>
> Skip the test if the command is not found.
>
>
The use of the truncate command here is to make the file 0 bytes. Rather
than skipping the test if the truncate command is not present, the test
could be altered to make the file 0 bytes in some other way.

# dd if=/dev/null of=gw1/ovn-controller.log
# > gw1-controller.log
# rm gw1-controller.log && touch gw1/ovn-controller.log

Are potential ways of expressing the same thing without needing to use
truncate.


> Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
> ---
>  tests/ovn.at | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index f203529..4563964 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -8432,6 +8432,7 @@ AT_CLEANUP
>
>  AT_SETUP([ovn -- ensure one gw controller restart in HA doesn't bounce
> the master])
>  AT_SKIP_IF([test $HAVE_PYTHON = no])
> +AT_SKIP_IF([!(test -x "$(command -v truncate)")])
>  ovn_start
>
>  net_add n1
> --
> 2.10.2.windows.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Mark Michelson Sept. 11, 2017, 8:05 p.m. UTC | #2
On Mon, Sep 11, 2017 at 2:59 PM Mark Michelson <mmichels@redhat.com> wrote:

> On Mon, Sep 11, 2017 at 2:37 PM Alin Gabriel Serdean <aserdean@ovn.org>
> wrote:
>
>> Test: "testing ovn -- ensure one gw controller restart in HA doesn't
>> bounce the master" uses the command `truncate`.
>>
>> Skip the test if the command is not found.
>>
>>
> The use of the truncate command here is to make the file 0 bytes. Rather
> than skipping the test if the truncate command is not present, the test
> could be altered to make the file 0 bytes in some other way.
>
> # dd if=/dev/null of=gw1/ovn-controller.log
> # > gw1-controller.log
> # rm gw1-controller.log && touch gw1/ovn-controller.log
>
> Are potential ways of expressing the same thing without needing to use
> truncate.
>

OOps, I typoed the filename in those last two suggestions. They should be

# > gw1/ovn-controller.log
# rm gw1/ovn-controller.log && touch gw1/ovn-controller.log
Alin Serdean Sept. 11, 2017, 8:28 p.m. UTC | #3
> On Mon, Sep 11, 2017 at 2:59 PM Mark Michelson <mmichels@redhat.com>

> wrote:

> 

> > On Mon, Sep 11, 2017 at 2:37 PM Alin Gabriel Serdean

> > <aserdean@ovn.org>

> > wrote:

> >

> >> Test: "testing ovn -- ensure one gw controller restart in HA doesn't

> >> bounce the master" uses the command `truncate`.

> >>

> >> Skip the test if the command is not found.

> >>

> >>

> > The use of the truncate command here is to make the file 0 bytes.

> > Rather than skipping the test if the truncate command is not present,

> > the test could be altered to make the file 0 bytes in some other way.

> >

> > # dd if=/dev/null of=gw1/ovn-controller.log # > gw1-controller.log #

> > rm gw1-controller.log && touch gw1/ovn-controller.log

> >

> > Are potential ways of expressing the same thing without needing to use

> > truncate.

> >

> 

> OOps, I typoed the filename in those last two suggestions. They should be

> 

> # > gw1/ovn-controller.log

> # rm gw1/ovn-controller.log && touch gw1/ovn-controller.log

> _______________________________________________

[Alin Serdean] Thanks for the quick review Mark!
Sorry I didn't look at the actual test.
I just saw it failed and:
"ovs/tests/testsuite.dir/at-groups/2364/test-source: line 82: truncate: command not found"
in the log.
Short story msys does not have truncate, msys2 has it that's why I was so eager 😊.

I would avoid using dd with /dev/null because that would also a bit specific.

I tested with the following
diff --git a/tests/ovn.at b/tests/ovn.at
index 2a00232..572102b 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -8501,7 +8501,8 @@ ovn-nbctl --wait=hv --timeout=3 sync
 # doesn't have the same effect because "name" is conserved, and the
 # Chassis entry is not replaced.

-truncate -s 0 gw1/ovn-controller.log
+#truncate -s 0 gw1/ovn-controller.log
+> gw1/ovn-controller.log

 gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)
 ovn-sbctl destroy Chassis $gw2_chassis

Do you mind sending out a patch for it?

Alin.
Mark Michelson Sept. 11, 2017, 8:59 p.m. UTC | #4
On Mon, Sep 11, 2017 at 3:37 PM Alin Serdean <
aserdean@cloudbasesolutions.com> wrote:

> > On Mon, Sep 11, 2017 at 2:59 PM Mark Michelson <mmichels@redhat.com>
> > wrote:
> >
> > > On Mon, Sep 11, 2017 at 2:37 PM Alin Gabriel Serdean
> > > <aserdean@ovn.org>
> > > wrote:
> > >
> > >> Test: "testing ovn -- ensure one gw controller restart in HA doesn't
> > >> bounce the master" uses the command `truncate`.
> > >>
> > >> Skip the test if the command is not found.
> > >>
> > >>
> > > The use of the truncate command here is to make the file 0 bytes.
> > > Rather than skipping the test if the truncate command is not present,
> > > the test could be altered to make the file 0 bytes in some other way.
> > >
> > > # dd if=/dev/null of=gw1/ovn-controller.log # > gw1-controller.log #
> > > rm gw1-controller.log && touch gw1/ovn-controller.log
> > >
> > > Are potential ways of expressing the same thing without needing to use
> > > truncate.
> > >
> >
> > OOps, I typoed the filename in those last two suggestions. They should be
> >
> > # > gw1/ovn-controller.log
> > # rm gw1/ovn-controller.log && touch gw1/ovn-controller.log
> > _______________________________________________
> [Alin Serdean] Thanks for the quick review Mark!
> Sorry I didn't look at the actual test.
> I just saw it failed and:
> "ovs/tests/testsuite.dir/at-groups/2364/test-source: line 82: truncate:
> command not found"
> in the log.
> Short story msys does not have truncate, msys2 has it that's why I was so
> eager 😊.
>
> I would avoid using dd with /dev/null because that would also a bit
> specific.
>
> I tested with the following
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 2a00232..572102b 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -8501,7 +8501,8 @@ ovn-nbctl --wait=hv --timeout=3 sync
>  # doesn't have the same effect because "name" is conserved, and the
>  # Chassis entry is not replaced.
>
> -truncate -s 0 gw1/ovn-controller.log
> +#truncate -s 0 gw1/ovn-controller.log
> +> gw1/ovn-controller.log
>
>  gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)
>  ovn-sbctl destroy Chassis $gw2_chassis
>
> Do you mind sending out a patch for it?
>
> Alin.
>

Patch is here:
https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338627.html
Alin-Gabriel Serdean Sept. 11, 2017, 9:58 p.m. UTC | #5
Do you mind sending out a patch for it?

Alin.

 

Patch is here: https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338627.html

 

 

[Alin Serdean] Thanks! I tested and acked it.
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index f203529..4563964 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -8432,6 +8432,7 @@  AT_CLEANUP
 
 AT_SETUP([ovn -- ensure one gw controller restart in HA doesn't bounce the master])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
+AT_SKIP_IF([!(test -x "$(command -v truncate)")])
 ovn_start
 
 net_add n1