#!/bin/bash

. $(dirname $0)/functions

BASE=$BASEDIR/modify-test1
BUILD=$BUILDDIR/modify-test1

$RRDTOOL create ${BUILD}a.rrd --start 1300000000 --step 60 DS:a:GAUGE:120:0:U  RRA:AVERAGE:0.5:1:10 RRA:AVERAGE:0.5:5:10 || fail create

# add 50 values to 
N=10
for T in $(seq 1300000020 60 1300003020) ; do
	$RRDTOOL update ${BUILD}a.rrd --template a $T:$N || fail "update"
	let N=$N+10
done

$RRDTOOL dump ${BUILD}a.rrd | $DIFF9 - ${BASE}.create.dump 
report "created content"

# extend base RRA, refill from coarse RRA
cp ${BUILD}a.rrd ${BUILD}b.rrd
$RRDTOOL tune ${BUILD}b.rrd RRA#0:+10 || fail "tune"
$RRDTOOL dump ${BUILD}b.rrd | $DIFF9 - ${BASE}.mod1.dump 
report "extend base RRA"
